Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import cv2
|
|
8 |
import gradio as gr
|
9 |
from torchvision import transforms
|
10 |
import fire
|
|
|
11 |
|
12 |
controlnet = ControlNetModel.from_pretrained(
|
13 |
"geyongtao/HumanWild",
|
@@ -96,14 +97,25 @@ def run_demo():
|
|
96 |
with gr.Row():
|
97 |
with gr.Column():
|
98 |
input_image = gr.Image(sources=None, type="pil") # None for upload, ctrl+v and webcam
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
prompt = gr.Textbox(label="Prompt")
|
100 |
-
negative_prompt =
|
101 |
num_steps = gr.Slider(label="Number of steps", minimum=25, maximum=100, value=50, step=1)
|
102 |
controlnet_conditioning_scale = gr.Slider(label="ControlNet conditioning scale", minimum=0.1, maximum=2.0, value=1.0, step=0.05)
|
103 |
seed = gr.Slider(label="Seed", minimum=0, maximum=2147483647, step=1, randomize=True,)
|
104 |
run_button = gr.Button(value="Run")
|
105 |
-
|
106 |
-
|
107 |
with gr.Column():
|
108 |
result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery", columns=[2], height='auto')
|
109 |
ips = [input_image, prompt, negative_prompt, num_steps, controlnet_conditioning_scale, seed]
|
|
|
8 |
import gradio as gr
|
9 |
from torchvision import transforms
|
10 |
import fire
|
11 |
+
import os
|
12 |
|
13 |
controlnet = ControlNetModel.from_pretrained(
|
14 |
"geyongtao/HumanWild",
|
|
|
97 |
with gr.Row():
|
98 |
with gr.Column():
|
99 |
input_image = gr.Image(sources=None, type="pil") # None for upload, ctrl+v and webcam
|
100 |
+
|
101 |
+
example_folder = os.path.join(os.path.dirname(__file__), "./assets")
|
102 |
+
example_fns = [os.path.join(example_folder, example) for example in os.listdir(example_folder)]
|
103 |
+
gr.Examples(
|
104 |
+
examples=example_fns,
|
105 |
+
inputs=[input_image],
|
106 |
+
cache_examples=False,
|
107 |
+
label='Examples (click one of the images below to start)',
|
108 |
+
examples_per_page=30
|
109 |
+
)
|
110 |
+
|
111 |
prompt = gr.Textbox(label="Prompt")
|
112 |
+
negative_prompt = "Logo,Watermark,Text,Ugly,Morbid,Extra fingers,Poorly drawn hands,Mutation,Blurry,Extra limbs,Gross proportions,Missing arms,Mutated hands,Long neck,Duplicate,Mutilated,Mutilated hands,Poorly drawn face,Deformed,Bad anatomy,Cloned face,Malformed limbs,Missing legs,Too many fingers"
|
113 |
num_steps = gr.Slider(label="Number of steps", minimum=25, maximum=100, value=50, step=1)
|
114 |
controlnet_conditioning_scale = gr.Slider(label="ControlNet conditioning scale", minimum=0.1, maximum=2.0, value=1.0, step=0.05)
|
115 |
seed = gr.Slider(label="Seed", minimum=0, maximum=2147483647, step=1, randomize=True,)
|
116 |
run_button = gr.Button(value="Run")
|
117 |
+
|
118 |
+
|
119 |
with gr.Column():
|
120 |
result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery", columns=[2], height='auto')
|
121 |
ips = [input_image, prompt, negative_prompt, num_steps, controlnet_conditioning_scale, seed]
|