Spaces:
Runtime error
Runtime error
File size: 1,074 Bytes
48e3983 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import gradio as gr
import subprocess
def deblur_image(input_image_path, angle_model_path, length_model_path):
command = [
"python",
"deblur_img.py",
"--image",
input_image_path,
"--angle_model",
angle_model_path,
"--length_model",
length_model_path
]
result = subprocess.run(command, capture_output=True, text=True)
return result.stdout
def deblur_and_display(input_image, angle_model_path, length_model_path):
output = deblur_image(input_image.name, angle_model_path, length_model_path)
return output
iface = gr.Interface(
fn=deblur_and_display,
inputs=[
gr.inputs.Image(label="Upload Image"),
gr.inputs.Textbox(label="Angle Model Path", default="/app/pretrained_models/angle_model.hdf5"),
gr.inputs.Textbox(label="Length Model Path", default="/app/pretrained_models/length_model.hdf5")
],
outputs="text",
title="Image Deblurring App",
description="Upload an image to deblur it."
)
if __name__ == "__main__":
iface.launch()
|