Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -97,32 +97,65 @@ header = """
|
|
97 |
|
98 |
|
99 |
def create_app():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
with gr.Blocks() as app:
|
101 |
gr.Markdown(header, elem_id="header")
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
gr.
|
108 |
-
gr.Radio(
|
109 |
[("512", 512), ("1024(beta)", 1024)],
|
110 |
label="Resolution",
|
111 |
value=512,
|
112 |
elem_id="resolution",
|
113 |
-
)
|
114 |
-
|
115 |
-
gr.
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
)
|
120 |
-
|
121 |
-
# gr.Markdown("Coming soon")
|
122 |
-
# with gr.Tab("Canny"):
|
123 |
-
# gr.Markdown("Coming soon")
|
124 |
-
# with gr.Tab("Depth"):
|
125 |
-
# gr.Markdown("Coming soon")
|
126 |
return app
|
127 |
|
128 |
|
|
|
97 |
|
98 |
|
99 |
def create_app():
|
100 |
+
# with gr.Blocks() as app:
|
101 |
+
# gr.Markdown(header, elem_id="header")
|
102 |
+
# # with gr.Tabs():
|
103 |
+
# # with gr.Tab("Subject-driven"):
|
104 |
+
# gr.Interface(
|
105 |
+
# fn=process_image_and_text,
|
106 |
+
# inputs=[
|
107 |
+
# gr.Image(type="pil", label="Condition Image", width=300, elem_id="input"),
|
108 |
+
# gr.Radio(
|
109 |
+
# [("512", 512), ("1024(beta)", 1024)],
|
110 |
+
# label="Resolution",
|
111 |
+
# value=512,
|
112 |
+
# elem_id="resolution",
|
113 |
+
# ),
|
114 |
+
# # gr.Slider(4, 16, 4, step=4, label="Inference Steps"),
|
115 |
+
# gr.Textbox(lines=2, label="Text Prompt", elem_id="text"),
|
116 |
+
# ],
|
117 |
+
# outputs=gr.Image(type="pil", elem_id="output"),
|
118 |
+
# examples=get_samples(),
|
119 |
+
# )
|
120 |
+
# # with gr.Tab("Fill"):
|
121 |
+
# # gr.Markdown("Coming soon")
|
122 |
+
# # with gr.Tab("Canny"):
|
123 |
+
# # gr.Markdown("Coming soon")
|
124 |
+
# # with gr.Tab("Depth"):
|
125 |
+
# # gr.Markdown("Coming soon")
|
126 |
+
|
127 |
with gr.Blocks() as app:
|
128 |
gr.Markdown(header, elem_id="header")
|
129 |
+
with gr.Row(equal_height=False):
|
130 |
+
with gr.Column(variant="panel", elem_classes="inputPanel"):
|
131 |
+
original_image = gr.Image(
|
132 |
+
type="pil", label="Condition Image", width=300, elem_id="input"
|
133 |
+
)
|
134 |
+
resolution = gr.Radio(
|
|
|
135 |
[("512", 512), ("1024(beta)", 1024)],
|
136 |
label="Resolution",
|
137 |
value=512,
|
138 |
elem_id="resolution",
|
139 |
+
)
|
140 |
+
text = gr.Textbox(lines=2, label="Text Prompt", elem_id="text")
|
141 |
+
submit_btn = gr.Button("Run", elem_id="submit_btn")
|
142 |
+
|
143 |
+
with gr.Column(variant="panel", elem_classes="outputPanel"):
|
144 |
+
output_image = gr.Image(type="pil", elem_id="output")
|
145 |
+
|
146 |
+
with gr.Row():
|
147 |
+
examples = gr.Examples(
|
148 |
+
examples=get_samples(),
|
149 |
+
inputs=[original_image, resolution, text],
|
150 |
+
label="Examples",
|
151 |
+
)
|
152 |
+
|
153 |
+
submit_btn.click(
|
154 |
+
fn=process_image_and_text,
|
155 |
+
inputs=[original_image, resolution, text],
|
156 |
+
outputs=output_image,
|
157 |
)
|
158 |
+
|
|
|
|
|
|
|
|
|
|
|
159 |
return app
|
160 |
|
161 |
|