Unkowndev commited on
Commit
9a636d0
·
verified ·
1 Parent(s): cc73c80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -1,3 +1,32 @@
1
  import gradio as gr
2
 
3
- gr.load("models/black-forest-labs/FLUX.1-schnell").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Load the model
4
+ model = gr.load("models/black-forest-labs/FLUX.1-dev")
5
+
6
+ # Define the chatbot function
7
+ def chatbot(message, history):
8
+ # Add the user's message to the history
9
+ history.append({"role": "user", "content": message})
10
+
11
+ # Get the response from the model
12
+ response = model(message)
13
+
14
+ # Add the model's response to the history
15
+ history.append({"role": "assistant", "content": response})
16
+
17
+ return history
18
+
19
+ # Create the Gradio interface
20
+ with gr.Blocks(css="footer {visibility: hidden}") as demo:
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()