SoDa12321/Debluring-Motion
0
1import gradio as gr2import subprocess3 4def deblur_image(input_image_path, angle_model_path, length_model_path):5 command = [6 "python",7 "deblur_img.py",8 "--image",9 input_image_path,10 "--angle_model",11 angle_model_path,12 "--length_model",13 length_model_path14 ]15 result = subprocess.run(command, capture_output=True, text=True)16 return result.stdout17 18def deblur_and_display(input_image, angle_model_path, length_model_path):19 output = deblur_image(input_image.name, angle_model_path, length_model_path)20 return output21 22iface = gr.Interface(23 fn=deblur_and_display,24 inputs=[25 gr.inputs.Image(label="Upload Image"),26 gr.inputs.Textbox(label="Angle Model Path", default="/app/pretrained_models/angle_model.hdf5"),27 gr.inputs.Textbox(label="Length Model Path", default="/app/pretrained_models/length_model.hdf5")28 ],29 outputs="text",30 title="Image Deblurring App",31 description="Upload an image to deblur it."32)33 34if __name__ == "__main__":35 iface.launch()36 