Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -126,14 +126,17 @@ def response(instruction, input_image=None ):
|
|
| 126 |
if input_image is None:
|
| 127 |
output="Image Generation"
|
| 128 |
else:
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
| 137 |
output = "Image Generation"
|
| 138 |
return output
|
| 139 |
|
|
@@ -167,14 +170,13 @@ examples=[
|
|
| 167 |
[
|
| 168 |
"Image Generation",
|
| 169 |
None,
|
| 170 |
-
"
|
| 171 |
|
| 172 |
],
|
| 173 |
[
|
| 174 |
"Image Generation",
|
| 175 |
None,
|
| 176 |
"Beautiful Eiffel Tower at Night",
|
| 177 |
-
|
| 178 |
],
|
| 179 |
]
|
| 180 |
|
|
@@ -202,7 +204,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 202 |
show_label=False,
|
| 203 |
interactive=True,
|
| 204 |
)
|
| 205 |
-
seed = gr.Number(value=1371,
|
| 206 |
|
| 207 |
with gr.Row():
|
| 208 |
width = gr.Slider( label="Width", minimum=256, maximum=2048, step=64, value=1024)
|
|
|
|
| 126 |
if input_image is None:
|
| 127 |
output="Image Generation"
|
| 128 |
else:
|
| 129 |
+
try:
|
| 130 |
+
text = instruction
|
| 131 |
+
labels = ["Image Editing", "Image Generation"]
|
| 132 |
+
classification = client.zero_shot_classification(text, labels, multi_label=True)
|
| 133 |
+
output = classification[0]
|
| 134 |
+
output = str(output)
|
| 135 |
+
if "Editing" in output:
|
| 136 |
+
output = "Image Editing"
|
| 137 |
+
else:
|
| 138 |
+
output = "Image Generation"
|
| 139 |
+
except error:
|
| 140 |
output = "Image Generation"
|
| 141 |
return output
|
| 142 |
|
|
|
|
| 170 |
[
|
| 171 |
"Image Generation",
|
| 172 |
None,
|
| 173 |
+
"An alien grasping a sign board contain word 'ALIEN', futuristic, neonpunk, detailed",
|
| 174 |
|
| 175 |
],
|
| 176 |
[
|
| 177 |
"Image Generation",
|
| 178 |
None,
|
| 179 |
"Beautiful Eiffel Tower at Night",
|
|
|
|
| 180 |
],
|
| 181 |
]
|
| 182 |
|
|
|
|
| 204 |
show_label=False,
|
| 205 |
interactive=True,
|
| 206 |
)
|
| 207 |
+
seed = gr.Number(value=1371, step=1, label="Seed", interactive=True)
|
| 208 |
|
| 209 |
with gr.Row():
|
| 210 |
width = gr.Slider( label="Width", minimum=256, maximum=2048, step=64, value=1024)
|