Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#This code is
|
2 |
import gradio as gr
|
3 |
from PIL import Image, ImageFilter, ImageOps
|
4 |
from io import BytesIO
|
@@ -57,7 +57,9 @@ def generate_images(canvas,output_type):
|
|
57 |
input_img = get_canny_filter(input_img) if output_type == "Canny" else input_img
|
58 |
input_img = ImageOps.invert(input_img)
|
59 |
input_img.save("tmp.png")
|
60 |
-
|
|
|
|
|
61 |
def placeholder_fn(axis):
|
62 |
pass
|
63 |
with gr.Blocks() as b:
|
@@ -68,6 +70,7 @@ with gr.Blocks() as b:
|
|
68 |
pose_template = gr.Radio(choices=["regular", "ballet", "handstand", "split", "kick", "chilling"], value="regular", label="Pose template")
|
69 |
output_type = gr.Radio(choices=["Depth", "Canny"], value="Depth", label="Image Output")
|
70 |
run_button = gr.Button("Generate")
|
|
|
71 |
out_file=gr.File()
|
72 |
out_im = gr.Image(type='filepath',show_share_button=True)
|
73 |
|
@@ -83,7 +86,7 @@ with gr.Blocks() as b:
|
|
83 |
_js=js_pose_template)
|
84 |
run_button.click(fn=generate_images,
|
85 |
inputs=[canvas,output_type],
|
86 |
-
outputs=[out_im,out_file],
|
87 |
_js=get_js_image)
|
88 |
b.load(None,None,None,_js=load_js)
|
89 |
|
|
|
1 |
+
#This code is largely based on: https://huggingface.co/spaces/diffusers/controlnet-3d-pose
|
2 |
import gradio as gr
|
3 |
from PIL import Image, ImageFilter, ImageOps
|
4 |
from io import BytesIO
|
|
|
57 |
input_img = get_canny_filter(input_img) if output_type == "Canny" else input_img
|
58 |
input_img = ImageOps.invert(input_img)
|
59 |
input_img.save("tmp.png")
|
60 |
+
out = os.path.abspath("tmp.png")
|
61 |
+
out_url = f'https://omnibus-model-mover.hf.space/file={out}'
|
62 |
+
return "tmp.png","tmp.png",out
|
63 |
def placeholder_fn(axis):
|
64 |
pass
|
65 |
with gr.Blocks() as b:
|
|
|
70 |
pose_template = gr.Radio(choices=["regular", "ballet", "handstand", "split", "kick", "chilling"], value="regular", label="Pose template")
|
71 |
output_type = gr.Radio(choices=["Depth", "Canny"], value="Depth", label="Image Output")
|
72 |
run_button = gr.Button("Generate")
|
73 |
+
out_text = gr.Textbox(label="Image URL")
|
74 |
out_file=gr.File()
|
75 |
out_im = gr.Image(type='filepath',show_share_button=True)
|
76 |
|
|
|
86 |
_js=js_pose_template)
|
87 |
run_button.click(fn=generate_images,
|
88 |
inputs=[canvas,output_type],
|
89 |
+
outputs=[out_im,out_file,out_text],
|
90 |
_js=get_js_image)
|
91 |
b.load(None,None,None,_js=load_js)
|
92 |
|