Spaces:
Runtime error
Runtime error
main
Browse files- gradio_app.py +36 -27
gradio_app.py
CHANGED
@@ -159,7 +159,7 @@ def infer(prompt, sample_image, recraft_model, seed=0):
|
|
159 |
logger.error("Models not loaded. Please load the models first.")
|
160 |
return None
|
161 |
|
162 |
-
model_path = model_paths[
|
163 |
frame_num = model_path['Frame']
|
164 |
|
165 |
logger.info(f"Started generating image with prompt: {prompt}")
|
@@ -281,35 +281,44 @@ def infer(prompt, sample_image, recraft_model, seed=0):
|
|
281 |
# Gradio interface
|
282 |
with gr.Blocks() as demo:
|
283 |
gr.Markdown("## FLUX Image Generation")
|
284 |
-
|
285 |
-
with gr.Row():
|
286 |
-
# Dropdown for selecting the recraft model
|
287 |
-
recraft_model = gr.Dropdown(
|
288 |
-
label="Select Recraft Model",
|
289 |
-
choices=["Wood Sculpture", "LEGO", "Sketch", "Portrait"],
|
290 |
-
value="Wood Sculpture"
|
291 |
-
)
|
292 |
-
|
293 |
-
# Input for the prompt
|
294 |
-
prompt = gr.Textbox(label="Prompt", placeholder="Enter your prompt here", lines=1)
|
295 |
-
|
296 |
-
# File upload for image
|
297 |
-
sample_image = gr.Image(label="Upload a Conditional Image", type="pil")
|
298 |
-
|
299 |
-
# Seed
|
300 |
-
seed = gr.Slider(0, np.iinfo(np.int32).max, step=1, label="Seed", value=0)
|
301 |
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
# Load model button action
|
315 |
load_button.click(fn=load_target_model, inputs=[recraft_model], outputs=[status_box])
|
|
|
159 |
logger.error("Models not loaded. Please load the models first.")
|
160 |
return None
|
161 |
|
162 |
+
model_path = model_paths[recraft_model]
|
163 |
frame_num = model_path['Frame']
|
164 |
|
165 |
logger.info(f"Started generating image with prompt: {prompt}")
|
|
|
281 |
# Gradio interface
|
282 |
with gr.Blocks() as demo:
|
283 |
gr.Markdown("## FLUX Image Generation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
|
285 |
+
with gr.Row():
|
286 |
+
with gr.Column(scale=1):
|
287 |
+
# Dropdown for selecting the recraft model
|
288 |
+
recraft_model = gr.Dropdown(
|
289 |
+
label="Select Recraft Model",
|
290 |
+
choices=["Wood Sculpture", "LEGO", "Sketch", "Portrait"],
|
291 |
+
value="Wood Sculpture"
|
292 |
+
)
|
293 |
+
|
294 |
+
# Load Model Button
|
295 |
+
load_button = gr.Button("Load Model")
|
296 |
|
297 |
+
with gr.Column(scale=1):
|
298 |
+
# Status message box
|
299 |
+
status_box = gr.Textbox(label="Status", placeholder="Model loading status", interactive=False, value="Model not loaded")
|
300 |
+
|
301 |
+
with gr.Row():
|
302 |
+
with gr.Column(scale=2):
|
303 |
+
# Input for the prompt
|
304 |
+
prompt = gr.Textbox(label="Prompt", placeholder="Enter your prompt here", lines=1)
|
305 |
|
306 |
+
with gr.Column(scale=1):
|
307 |
+
# Seed
|
308 |
+
seed = gr.Slider(0, np.iinfo(np.int32).max, step=1, label="Seed", value=0)
|
309 |
+
|
310 |
+
with gr.Row():
|
311 |
+
with gr.Column(scale=2):
|
312 |
+
# File upload for image
|
313 |
+
sample_image = gr.Image(label="Upload a Conditional Image", type="pil")
|
314 |
+
|
315 |
+
with gr.Column(scale=1):
|
316 |
+
# Run Button
|
317 |
+
run_button = gr.Button("Generate Image")
|
318 |
+
|
319 |
+
with gr.Column(scale=1):
|
320 |
+
# Output result
|
321 |
+
result_image = gr.Image(label="Generated Image")
|
322 |
|
323 |
# Load model button action
|
324 |
load_button.click(fn=load_target_model, inputs=[recraft_model], outputs=[status_box])
|