Update app.py
Browse files
app.py
CHANGED
@@ -128,8 +128,10 @@ class TextToImageTool(Tool):
|
|
128 |
'''
|
129 |
image_generation_tool = Tool.from_space(
|
130 |
"black-forest-labs/FLUX.1-schnell",
|
|
|
131 |
name="image_generator",
|
132 |
-
description="Generate an image from a prompt"
|
|
|
133 |
|
134 |
|
135 |
# =========================================================
|
@@ -193,10 +195,10 @@ def generate_object_history(object_name):
|
|
193 |
|
194 |
gif_path = f"{object_name}_evolution.gif"
|
195 |
images[0].save(gif_path, save_all=True, append_images=images[1:], duration=1000, loop=0)
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
return images, gif_path
|
200 |
|
201 |
# =========================================================
|
202 |
# Gradio Interface
|
@@ -221,8 +223,8 @@ def create_gradio_interface():
|
|
221 |
with gr.Column():
|
222 |
object_name_input = gr.Textbox(label="Enter an object name", placeholder="e.g. bicycle, car, phone")
|
223 |
generate_button = gr.Button("Generate Evolution")
|
224 |
-
|
225 |
-
image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, type="filepath")
|
226 |
gif_output = gr.Image(label="Generated GIF", value=default_gif_path)
|
227 |
|
228 |
generate_button.click(fn=generate_object_history, inputs=[object_name_input], outputs=[image_gallery, gif_output])
|
|
|
128 |
'''
|
129 |
image_generation_tool = Tool.from_space(
|
130 |
"black-forest-labs/FLUX.1-schnell",
|
131 |
+
api_name="/infer", # Optional if there's only one endpoint
|
132 |
name="image_generator",
|
133 |
+
description="Generate an image from a prompt"
|
134 |
+
)
|
135 |
|
136 |
|
137 |
# =========================================================
|
|
|
195 |
|
196 |
gif_path = f"{object_name}_evolution.gif"
|
197 |
images[0].save(gif_path, save_all=True, append_images=images[1:], duration=1000, loop=0)
|
198 |
+
return [(f"{object_name}_past.png", labels["past"]),
|
199 |
+
(f"{object_name}_present.png", labels["present"]),
|
200 |
+
(f"{object_name}_future.png", labels["future"])], gif_path
|
201 |
+
#return images, gif_path
|
202 |
|
203 |
# =========================================================
|
204 |
# Gradio Interface
|
|
|
223 |
with gr.Column():
|
224 |
object_name_input = gr.Textbox(label="Enter an object name", placeholder="e.g. bicycle, car, phone")
|
225 |
generate_button = gr.Button("Generate Evolution")
|
226 |
+
image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, value=default_images)
|
227 |
+
#image_gallery = gr.Gallery(label="Generated Images", columns=3, rows=1, type="filepath")
|
228 |
gif_output = gr.Image(label="Generated GIF", value=default_gif_path)
|
229 |
|
230 |
generate_button.click(fn=generate_object_history, inputs=[object_name_input], outputs=[image_gallery, gif_output])
|