Paul-Louis Pröve
commited on
Commit
·
08ffe8d
1
Parent(s):
2f90484
added chat save
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
import os
|
|
|
|
|
2 |
import openai
|
3 |
import gradio as gr
|
4 |
|
@@ -67,6 +69,8 @@ def bot(history, results):
|
|
67 |
if "content" in chunk["choices"][0]["delta"]:
|
68 |
history[-1][1] = history[-1][1] + chunk["choices"][0]["delta"]["content"]
|
69 |
yield history
|
|
|
|
|
70 |
|
71 |
|
72 |
with gr.Blocks(
|
|
|
1 |
import os
|
2 |
+
import time
|
3 |
+
import json
|
4 |
import openai
|
5 |
import gradio as gr
|
6 |
|
|
|
69 |
if "content" in chunk["choices"][0]["delta"]:
|
70 |
history[-1][1] = history[-1][1] + chunk["choices"][0]["delta"]["content"]
|
71 |
yield history
|
72 |
+
with open("/data/" + str(time.time()).split(".")[0] + ".txt", "w") as f:
|
73 |
+
json.dump(history, f)
|
74 |
|
75 |
|
76 |
with gr.Blocks(
|