Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,19 +33,6 @@ retriever = vectorstore_persisted.as_retriever(
|
|
33 |
search_kwargs={'k': 5}
|
34 |
)
|
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 financial services firm who answers user queries on annual reports.
|
51 |
Users will ask questions delimited by triple backticks, that is, ```.
|
@@ -97,17 +84,6 @@ def predict(user_input):
|
|
97 |
# While writing to the log file, ensure that the commit scheduler is locked to avoid parallel
|
98 |
# access
|
99 |
|
100 |
-
with scheduler.lock:
|
101 |
-
with log_file.open("a") as f:
|
102 |
-
f.write(json.dumps(
|
103 |
-
{
|
104 |
-
'user_input': user_input,
|
105 |
-
'retrieved_context': context_for_query,
|
106 |
-
'model_response': prediction
|
107 |
-
}
|
108 |
-
))
|
109 |
-
f.write("\n")
|
110 |
-
|
111 |
return prediction
|
112 |
|
113 |
|
|
|
33 |
search_kwargs={'k': 5}
|
34 |
)
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
qna_system_message = """
|
37 |
You are an assistant to a financial services firm who answers user queries on annual reports.
|
38 |
Users will ask questions delimited by triple backticks, that is, ```.
|
|
|
84 |
# While writing to the log file, ensure that the commit scheduler is locked to avoid parallel
|
85 |
# access
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
return prediction
|
88 |
|
89 |
|