Spaces:
Sleeping
Sleeping
Update ChatGPT_app.py
Browse files- ChatGPT_app.py +15 -0
ChatGPT_app.py
CHANGED
|
@@ -49,5 +49,20 @@ window = RadioBlocks(chat_history)
|
|
| 49 |
window.mainloop()
|
| 50 |
# Print out the chat history
|
| 51 |
print("Chat History:")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
for message in chat_history:
|
| 53 |
print(f"{message[0]}: {message[1]}")
|
|
|
|
| 49 |
window.mainloop()
|
| 50 |
# Print out the chat history
|
| 51 |
print("Chat History:")
|
| 52 |
+
for message in chat_history:
|
| 53 |
+
print(f"{message[0]}: {message[1]}")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# fix
|
| 57 |
+
|
| 58 |
+
chat_history = [
|
| 59 |
+
["User", prompt],
|
| 60 |
+
["OpenAI", responses["choices"][0]["text"]]
|
| 61 |
+
]
|
| 62 |
+
|
| 63 |
+
# Create the radio blocks window
|
| 64 |
+
window = gr.Interface(title="History", fn=lambda: chat_history, inputs=None, outputs=chat_history, live=True).launch(share=True)
|
| 65 |
+
# Print out the chat history
|
| 66 |
+
print("Chat History:")
|
| 67 |
for message in chat_history:
|
| 68 |
print(f"{message[0]}: {message[1]}")
|