Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
model = gr.load("models/black-forest-labs/FLUX.1-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
history.append({"role": "user", "content": message})
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
history.append({"role": "assistant", "content": response})
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
gr.Markdown("# FLUX.1-dev Chatbot")
|
22 |
-
gr.Markdown("Welcome! This chatbot uses the FLUX.1-dev model. Feel free to ask anything!")
|
23 |
-
|
24 |
-
chatbot = gr.Chatbot(height=400)
|
25 |
-
msg = gr.Textbox(label="Type your message here...")
|
26 |
-
clear = gr.Button("Clear")
|
27 |
-
|
28 |
-
msg.submit(chatbot, [msg, chatbot], [chatbot])
|
29 |
-
clear.click(lambda: None, None, chatbot, queue=False)
|
30 |
-
|
31 |
-
# Launch the interface
|
32 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def generate_image(prompt):
|
4 |
+
model = gr.load("models/black-forest-labs/FLUX.1-schnell")
|
5 |
+
return model(prompt)
|
6 |
|
7 |
+
with gr.Blocks() as demo:
|
8 |
+
gr.Markdown("# Text to Image Generator")
|
9 |
+
gr.Markdown("Enter a text prompt to generate an image using the FLUX.1-dev model.")
|
|
|
10 |
|
11 |
+
with gr.Row():
|
12 |
+
with gr.Column(scale=4):
|
13 |
+
text_input = gr.Textbox(label="Text Prompt", placeholder="Enter your prompt here...")
|
14 |
+
with gr.Column(scale=1):
|
15 |
+
submit_button = gr.Button("Generate Image")
|
16 |
|
17 |
+
image_output = gr.Image(label="Generated Image")
|
|
|
18 |
|
19 |
+
submit_button.click(fn=generate_image, inputs=text_input, outputs=image_output)
|
20 |
|
21 |
+
if __name__ == "__main__":
|
22 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|