Update app.py
Browse files
app.py
CHANGED
@@ -82,4 +82,57 @@ def generate_image(prompt):
|
|
82 |
return None, f"⚠️ Error: {str(e)[:200]}"
|
83 |
|
84 |
# ===== GRADIO INTERFACE =====
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
return None, f"⚠️ Error: {str(e)[:200]}"
|
83 |
|
84 |
# ===== GRADIO INTERFACE =====
|
85 |
+
with gr.Blocks(theme=theme, title="SelamGPT Image Generator") as demo:
|
86 |
+
gr.Markdown("""
|
87 |
+
# 🎨 SelamGPT Image Generator
|
88 |
+
*Powered by HiDream-I1-Full (1024x1024 PNG output)*
|
89 |
+
""")
|
90 |
+
|
91 |
+
with gr.Row():
|
92 |
+
with gr.Column(scale=3):
|
93 |
+
prompt_input = gr.Textbox(
|
94 |
+
label="Describe your image",
|
95 |
+
placeholder="A futuristic Ethiopian city with flying cars...",
|
96 |
+
lines=3,
|
97 |
+
max_lines=5
|
98 |
+
)
|
99 |
+
with gr.Row():
|
100 |
+
generate_btn = gr.Button("Generate Image", variant="primary")
|
101 |
+
clear_btn = gr.Button("Clear")
|
102 |
+
|
103 |
+
gr.Examples(
|
104 |
+
examples=[
|
105 |
+
["An ancient Aksumite warrior in cyberpunk armor, 4k detailed"],
|
106 |
+
["Traditional Ethiopian coffee ceremony in zero gravity"],
|
107 |
+
["Portrait of a Habesha queen with golden jewelry"]
|
108 |
+
],
|
109 |
+
inputs=prompt_input
|
110 |
+
)
|
111 |
+
|
112 |
+
with gr.Column(scale=2):
|
113 |
+
output_image = gr.Image(
|
114 |
+
label="Generated Image",
|
115 |
+
type="pil",
|
116 |
+
format="png",
|
117 |
+
height=512
|
118 |
+
)
|
119 |
+
status_output = gr.Textbox(
|
120 |
+
label="Status",
|
121 |
+
interactive=False
|
122 |
+
)
|
123 |
+
|
124 |
+
generate_btn.click(
|
125 |
+
fn=generate_image,
|
126 |
+
inputs=prompt_input,
|
127 |
+
outputs=[output_image, status_output],
|
128 |
+
queue=True
|
129 |
+
)
|
130 |
+
|
131 |
+
clear_btn.click(
|
132 |
+
fn=lambda: [None, ""],
|
133 |
+
outputs=[output_image, status_output]
|
134 |
+
)
|
135 |
+
|
136 |
+
if __name__ == "__main__":
|
137 |
+
demo.queue(max_size=2)
|
138 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|