Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,69 +34,66 @@ def generate_image(prompt, height, width, steps, scale, seed):
|
|
34 |
except Exception as e:
|
35 |
return f"An error occurred: {e}"
|
36 |
|
37 |
-
# Define the
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
)
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
)
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
[
|
94 |
-
|
95 |
-
|
96 |
-
],
|
97 |
-
allow_flagging="never"
|
98 |
-
)
|
99 |
|
100 |
-
# Launch the
|
101 |
if __name__ == "__main__":
|
102 |
-
|
|
|
34 |
except Exception as e:
|
35 |
return f"An error occurred: {e}"
|
36 |
|
37 |
+
# Define the Gradio interface using the updated API
|
38 |
+
with gr.Blocks() as demo:
|
39 |
+
gr.Markdown("# Hyper-FLUX-8Steps-LoRA Image Generator")
|
40 |
+
gr.Markdown(
|
41 |
+
"""
|
42 |
+
Enter a text prompt and adjust the parameters to generate an image using the Hyper-FLUX-8Steps-LoRA model.
|
43 |
+
"""
|
44 |
+
)
|
45 |
+
|
46 |
+
with gr.Row():
|
47 |
+
with gr.Column():
|
48 |
+
prompt = gr.Textbox(
|
49 |
+
label="Prompt",
|
50 |
+
placeholder="Enter your image description here...",
|
51 |
+
lines=2
|
52 |
+
)
|
53 |
+
height = gr.Slider(
|
54 |
+
label="Height",
|
55 |
+
minimum=256,
|
56 |
+
maximum=2048,
|
57 |
+
step=64,
|
58 |
+
value=1024
|
59 |
+
)
|
60 |
+
width = gr.Slider(
|
61 |
+
label="Width",
|
62 |
+
minimum=256,
|
63 |
+
maximum=2048,
|
64 |
+
step=64,
|
65 |
+
value=1024
|
66 |
+
)
|
67 |
+
steps = gr.Slider(
|
68 |
+
label="Steps",
|
69 |
+
minimum=1,
|
70 |
+
maximum=50,
|
71 |
+
step=1,
|
72 |
+
value=8
|
73 |
+
)
|
74 |
+
scale = gr.Slider(
|
75 |
+
label="Scale",
|
76 |
+
minimum=1.0,
|
77 |
+
maximum=10.0,
|
78 |
+
step=0.1,
|
79 |
+
value=3.5
|
80 |
+
)
|
81 |
+
seed = gr.Number(
|
82 |
+
label="Seed",
|
83 |
+
value=3413,
|
84 |
+
precision=0
|
85 |
+
)
|
86 |
+
generate_btn = gr.Button("Generate Image")
|
87 |
+
|
88 |
+
with gr.Column():
|
89 |
+
output = gr.Image(label="Generated Image")
|
90 |
+
|
91 |
+
generate_btn.click(
|
92 |
+
fn=generate_image,
|
93 |
+
inputs=[prompt, height, width, steps, scale, seed],
|
94 |
+
outputs=output
|
95 |
+
)
|
|
|
|
|
|
|
96 |
|
97 |
+
# Launch the Gradio app
|
98 |
if __name__ == "__main__":
|
99 |
+
demo.launch()
|