Spaces:
Runtime error
Runtime error
Commit
·
931206b
1
Parent(s):
fc21a71
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
from typing import List, Tuple, Dict, Generator
|
2 |
from langchain.llms import OpenAI
|
3 |
import gradio as gr
|
4 |
-
import json
|
5 |
model_name = "gpt-3.5-turbo"
|
6 |
LLM = OpenAI(model_name=model_name, temperature=0.1)
|
7 |
-
qa_data_file_path='qa.txt'
|
8 |
def save_qa_data(qa_data, file_path):
|
9 |
with open(file_path, 'w', encoding='utf-8') as f:
|
10 |
json.dump(qa_data, f, ensure_ascii=False, indent=4)
|
@@ -72,8 +70,6 @@ def chat(
|
|
72 |
break
|
73 |
formatted_history = create_formatted_history(history_messages)
|
74 |
yield formatted_history, history_messages
|
75 |
-
qa_data = formatted_history[-1]
|
76 |
-
save_qa_data(qa_data, qa_data_file_path)
|
77 |
chatbot = gr.Chatbot(label="Chat").style(color_map=("yellow", "purple"))
|
78 |
iface = gr.Interface(
|
79 |
fn=chat,
|
|
|
1 |
from typing import List, Tuple, Dict, Generator
|
2 |
from langchain.llms import OpenAI
|
3 |
import gradio as gr
|
|
|
4 |
model_name = "gpt-3.5-turbo"
|
5 |
LLM = OpenAI(model_name=model_name, temperature=0.1)
|
|
|
6 |
def save_qa_data(qa_data, file_path):
|
7 |
with open(file_path, 'w', encoding='utf-8') as f:
|
8 |
json.dump(qa_data, f, ensure_ascii=False, indent=4)
|
|
|
70 |
break
|
71 |
formatted_history = create_formatted_history(history_messages)
|
72 |
yield formatted_history, history_messages
|
|
|
|
|
73 |
chatbot = gr.Chatbot(label="Chat").style(color_map=("yellow", "purple"))
|
74 |
iface = gr.Interface(
|
75 |
fn=chat,
|