Spaces:
Runtime error
Runtime error
vericudebuget
commited on
Commit
•
6b4ef39
1
Parent(s):
29dc230
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def generate(prompt, history, system_prompt, temperature=0.9, max_new_tokens=904
|
|
35 |
output = ""
|
36 |
for response in stream:
|
37 |
output += response.token.text
|
38 |
-
|
39 |
|
40 |
additional_inputs = [
|
41 |
gr.Textbox(label="System Prompt", max_lines=1, interactive=True),
|
@@ -49,13 +49,10 @@ app = gr.Blocks(theme=gr.themes.Soft())
|
|
49 |
with app:
|
50 |
chatbot = gr.Chatbot()
|
51 |
text_input = gr.Textbox(label="Your message")
|
52 |
-
submit_btn = gr.Button("Submit")
|
53 |
|
54 |
def process_message(message, history):
|
55 |
-
response
|
56 |
-
|
57 |
-
return history, ""
|
58 |
-
|
59 |
-
submit_btn.click(process_message, inputs=[text_input, chatbot], outputs=[chatbot, text_input])
|
60 |
|
|
|
61 |
app.launch(show_api=False)
|
|
|
35 |
output = ""
|
36 |
for response in stream:
|
37 |
output += response.token.text
|
38 |
+
yield (prompt, output)
|
39 |
|
40 |
additional_inputs = [
|
41 |
gr.Textbox(label="System Prompt", max_lines=1, interactive=True),
|
|
|
49 |
with app:
|
50 |
chatbot = gr.Chatbot()
|
51 |
text_input = gr.Textbox(label="Your message")
|
|
|
52 |
|
53 |
def process_message(message, history):
|
54 |
+
for response in generate(message, history, additional_inputs[0].value):
|
55 |
+
yield response
|
|
|
|
|
|
|
56 |
|
57 |
+
text_input.submit(process_message, inputs=[text_input, chatbot], outputs=[chatbot, text_input])
|
58 |
app.launch(show_api=False)
|