Update app.py
Browse files
app.py
CHANGED
@@ -86,30 +86,22 @@ additional_inputs = [
|
|
86 |
with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
|
87 |
gr.Markdown("# Chatbot with Image Generation")
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
def respond(user_input, temperature, max_tokens, top_p, repetition_penalty, chat_history=[]):
|
108 |
-
for response, image in generate_response(user_input, chat_history, temperature, max_tokens, top_p, repetition_penalty):
|
109 |
-
if image:
|
110 |
-
return "", image, gr.update(visible=True)
|
111 |
-
return response, None, gr.update(visible=False)
|
112 |
-
|
113 |
-
chat_button.click(respond, inputs=[chat_input, temperature, max_tokens, top_p, repetition_penalty], outputs=[chat_output, image_output, image_output])
|
114 |
|
115 |
demo.launch()
|
|
|
86 |
with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
|
87 |
gr.Markdown("# Chatbot with Image Generation")
|
88 |
|
89 |
+
chat_history = gr.Chatbot()
|
90 |
+
chat_input = gr.Textbox(label="User Input", placeholder="Type your message here...")
|
91 |
+
chat_output = gr.Textbox(label="Chatbot Response")
|
92 |
+
image_output = gr.Image(label="Generated Image", visible=False)
|
93 |
+
temperature = gr.Slider(label="Temperature", minimum=0.1, maximum=1.0, value=0.7, step=0.1)
|
94 |
+
max_tokens = gr.Slider(label="Max Tokens", minimum=10, maximum=512, value=100, step=10)
|
95 |
+
top_p = gr.Slider(label="Top-p", minimum=0.1, maximum=1.0, value=0.9, step=0.1)
|
96 |
+
repetition_penalty = gr.Slider(label="Repetition Penalty", minimum=1.0, maximum=2.0, value=1.2, step=0.1)
|
97 |
+
chat_button = gr.Button("Send")
|
98 |
+
|
99 |
+
def respond(user_input, temperature, max_tokens, top_p, repetition_penalty, chat_history=[]):
|
100 |
+
for response, image in generate_response(user_input, chat_history, temperature, max_tokens, top_p, repetition_penalty):
|
101 |
+
if image:
|
102 |
+
return "", image, gr.update(visible=True)
|
103 |
+
return response, None, gr.update(visible=False)
|
104 |
+
|
105 |
+
chat_button.click(respond, inputs=[chat_input, temperature, max_tokens, top_p, repetition_penalty], outputs=[chat_output, image_output, image_output])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
demo.launch()
|