Spaces:
Runtime error
Runtime error
davoodwadi
commited on
Commit
•
805fef7
1
Parent(s):
e24ed2c
Upload app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ from openai import OpenAI
|
|
9 |
from langchain_community.embeddings.sentence_transformer import SentenceTransformerEmbeddings
|
10 |
from langchain_community.vectorstores import Chroma
|
11 |
|
12 |
-
from huggingface_hub import CommitScheduler
|
13 |
from pathlib import Path
|
14 |
|
15 |
|
@@ -35,16 +35,16 @@ retriever = vectorstore_persisted.as_retriever(
|
|
35 |
|
36 |
# Prepare the logging functionality
|
37 |
|
38 |
-
log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
39 |
-
log_folder = log_file.parent
|
40 |
|
41 |
-
scheduler = CommitScheduler(
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
)
|
48 |
|
49 |
qna_system_message = """
|
50 |
You are an assistant to a coder. Your task is to provide relevant information about the Python package Streamlit.
|
@@ -102,7 +102,8 @@ def predict(user_input):
|
|
102 |
|
103 |
try:
|
104 |
response = client.chat.completions.create(
|
105 |
-
model='mistralai/Mixtral-8x7B-Instruct-v0.1',
|
|
|
106 |
messages=prompt,
|
107 |
temperature=0
|
108 |
)
|
@@ -116,16 +117,16 @@ def predict(user_input):
|
|
116 |
# While writing to the log file, ensure that the commit scheduler is locked to avoid parallel
|
117 |
# access
|
118 |
|
119 |
-
with scheduler.lock:
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
|
130 |
return prediction
|
131 |
|
|
|
9 |
from langchain_community.embeddings.sentence_transformer import SentenceTransformerEmbeddings
|
10 |
from langchain_community.vectorstores import Chroma
|
11 |
|
12 |
+
# from huggingface_hub import CommitScheduler
|
13 |
from pathlib import Path
|
14 |
|
15 |
|
|
|
35 |
|
36 |
# Prepare the logging functionality
|
37 |
|
38 |
+
# log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
39 |
+
# log_folder = log_file.parent
|
40 |
|
41 |
+
# scheduler = CommitScheduler(
|
42 |
+
# repo_id="document-qna-chroma-anyscale-logs",
|
43 |
+
# repo_type="dataset",
|
44 |
+
# folder_path=log_folder,
|
45 |
+
# path_in_repo="data",
|
46 |
+
# every=2
|
47 |
+
# )
|
48 |
|
49 |
qna_system_message = """
|
50 |
You are an assistant to a coder. Your task is to provide relevant information about the Python package Streamlit.
|
|
|
102 |
|
103 |
try:
|
104 |
response = client.chat.completions.create(
|
105 |
+
# model='mistralai/Mixtral-8x7B-Instruct-v0.1',
|
106 |
+
model='gpt-35-turbo'
|
107 |
messages=prompt,
|
108 |
temperature=0
|
109 |
)
|
|
|
117 |
# While writing to the log file, ensure that the commit scheduler is locked to avoid parallel
|
118 |
# access
|
119 |
|
120 |
+
# with scheduler.lock:
|
121 |
+
# with log_file.open("a") as f:
|
122 |
+
# f.write(json.dumps(
|
123 |
+
# {
|
124 |
+
# 'user_input': user_input,
|
125 |
+
# 'retrieved_context': context_for_query,
|
126 |
+
# 'model_response': prediction
|
127 |
+
# }
|
128 |
+
# ))
|
129 |
+
# f.write("\n")
|
130 |
|
131 |
return prediction
|
132 |
|