Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
+
76 + demo = gr.Interface(
|
| 77 |
+
77 + fn=predict,
|
| 78 |
+
78 + inputs=[
|
| 79 |
+
79 + gr.Textbox(label="Message", placeholder="Enter your message"),
|
| 80 |
+
80 + gr.State(label="Conversation History") # State is used to manage history
|
| 81 |
+
81 + ],
|
| 82 |
+
82 + outputs=gr.Textbox(label="Response"),
|
| 83 |
+
83 + live=True
|
| 84 |
+
84 + ).queue()
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
demo.launch()
|