Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import os
|
|
| 4 |
|
| 5 |
def generate(image, prompt, seed):
|
| 6 |
print(image, prompt, seed)
|
|
|
|
| 7 |
command = f"python handrefiner.py --input_img {image} --out_dir output --strength 0.55 --weights models/inpaint_depth_control.ckpt --prompt '{prompt}' --seed {seed}"
|
| 8 |
try:
|
| 9 |
result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
@@ -17,7 +18,7 @@ def generate(image, prompt, seed):
|
|
| 17 |
for item in contents:
|
| 18 |
print(item)
|
| 19 |
|
| 20 |
-
return "
|
| 21 |
except subprocess.CalledProcessError as e:
|
| 22 |
print("Error:", e.stderr)
|
| 23 |
return None
|
|
@@ -29,8 +30,8 @@ with gr.Blocks() as demo:
|
|
| 29 |
textbox = gr.Textbox(show_label=False, value="a person facing the camera, making a hand gesture, indoor")
|
| 30 |
seed = gr.Slider(minimum=0, maximum=1000000, value=643534)
|
| 31 |
button = gr.Button()
|
| 32 |
-
|
| 33 |
-
output_image = gr.Textbox()
|
| 34 |
button.click(fn=generate, inputs=[image, textbox, seed], outputs=[output_image])
|
| 35 |
|
| 36 |
demo.queue().launch(inline=False, share=True, debug=True)
|
|
|
|
| 4 |
|
| 5 |
def generate(image, prompt, seed):
|
| 6 |
print(image, prompt, seed)
|
| 7 |
+
image_name = os.path.splitext(image)[0]
|
| 8 |
command = f"python handrefiner.py --input_img {image} --out_dir output --strength 0.55 --weights models/inpaint_depth_control.ckpt --prompt '{prompt}' --seed {seed}"
|
| 9 |
try:
|
| 10 |
result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
|
|
| 18 |
for item in contents:
|
| 19 |
print(item)
|
| 20 |
|
| 21 |
+
return f"output/{image_name}_512_0.jpg"
|
| 22 |
except subprocess.CalledProcessError as e:
|
| 23 |
print("Error:", e.stderr)
|
| 24 |
return None
|
|
|
|
| 30 |
textbox = gr.Textbox(show_label=False, value="a person facing the camera, making a hand gesture, indoor")
|
| 31 |
seed = gr.Slider(minimum=0, maximum=1000000, value=643534)
|
| 32 |
button = gr.Button()
|
| 33 |
+
output_image = gr.Image(show_label=False, type="filepath", interactive=False, height=512, width=512)
|
| 34 |
+
#output_image = gr.Textbox()
|
| 35 |
button.click(fn=generate, inputs=[image, textbox, seed], outputs=[output_image])
|
| 36 |
|
| 37 |
demo.queue().launch(inline=False, share=True, debug=True)
|