Spaces:
Runtime error
Runtime error
Update app.py
#1
by
soiz1
- opened
app.py
CHANGED
|
@@ -72,7 +72,16 @@ def predict(message, history):
|
|
| 72 |
partial_message = partial_message + chunk['choices'][0]['delta']['content']
|
| 73 |
yield partial_message
|
| 74 |
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|
| 78 |
demo.launch()
|
|
|
|
| 72 |
partial_message = partial_message + chunk['choices'][0]['delta']['content']
|
| 73 |
yield partial_message
|
| 74 |
|
| 75 |
+
# Adjust the Gradio interface for a chatbot
|
| 76 |
+
demo = gr.Interface(
|
| 77 |
+
fn=predict,
|
| 78 |
+
inputs=[
|
| 79 |
+
gr.Textbox(label="Message", placeholder="Enter your message"),
|
| 80 |
+
gr.State(label="Conversation History") # State is used to manage history
|
| 81 |
+
],
|
| 82 |
+
outputs=gr.Textbox(label="Response"),
|
| 83 |
+
live=True
|
| 84 |
+
).queue()
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
demo.launch()
|