Update app.py
Browse files
app.py
CHANGED
@@ -7,15 +7,13 @@ from openai import OpenAI
|
|
7 |
from datetime import datetime
|
8 |
import pandas as pd
|
9 |
import os
|
|
|
10 |
|
11 |
from huggingface_hub import HfFileSystem
|
12 |
token = os.getenv('FILE_TOKEN')
|
13 |
-
|
14 |
-
st.write(token)
|
15 |
-
|
16 |
fs = HfFileSystem(token=token)
|
17 |
|
18 |
-
|
19 |
|
20 |
|
21 |
api_key=os.environ["OPENAI_API_KEY"]
|
@@ -58,11 +56,7 @@ system_instructions_text='''
|
|
58 |
If you are unable to answer the question from the text provided, please respond " Sorry. I do not have enough information to answer this"
|
59 |
Do repeat the question. Do not make a pointed reference to the text provided. Directly answer the question
|
60 |
'''
|
61 |
-
|
62 |
-
try:
|
63 |
-
df_log=pd.read_csv(logfile, index_col=0)
|
64 |
-
except:
|
65 |
-
df_log=pd.DataFrame(columns=['query','url','score','ans', 'ts'])
|
66 |
|
67 |
def query_from_pinecone(index,namespace, question_embedding, top_k=3):
|
68 |
# get embedding from THE SAME embedder as the documents
|
@@ -97,6 +91,14 @@ def write_log(query,url, score, ans, ts):
|
|
97 |
f.write(buffer)
|
98 |
|
99 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
st.title('CLLM Answering Machine')
|
102 |
|
|
|
7 |
from datetime import datetime
|
8 |
import pandas as pd
|
9 |
import os
|
10 |
+
import time
|
11 |
|
12 |
from huggingface_hub import HfFileSystem
|
13 |
token = os.getenv('FILE_TOKEN')
|
|
|
|
|
|
|
14 |
fs = HfFileSystem(token=token)
|
15 |
|
16 |
+
|
17 |
|
18 |
|
19 |
api_key=os.environ["OPENAI_API_KEY"]
|
|
|
56 |
If you are unable to answer the question from the text provided, please respond " Sorry. I do not have enough information to answer this"
|
57 |
Do repeat the question. Do not make a pointed reference to the text provided. Directly answer the question
|
58 |
'''
|
59 |
+
|
|
|
|
|
|
|
|
|
60 |
|
61 |
def query_from_pinecone(index,namespace, question_embedding, top_k=3):
|
62 |
# get embedding from THE SAME embedder as the documents
|
|
|
91 |
f.write(buffer)
|
92 |
|
93 |
return
|
94 |
+
|
95 |
+
logfile='querylog.csv'
|
96 |
+
try:
|
97 |
+
df_log=pd.read_csv(logfile, index_col=0)
|
98 |
+
except:
|
99 |
+
df_log=pd.DataFrame(columns=['query','url','score','ans', 'ts'])
|
100 |
+
|
101 |
+
|
102 |
|
103 |
st.title('CLLM Answering Machine')
|
104 |
|