Upload app.py
Browse files
app.py
CHANGED
@@ -125,18 +125,18 @@ print (answer)
|
|
125 |
# While writing to the log file, ensure that the commit scheduler is locked to avoid parallel
|
126 |
# access
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
|
141 |
# Set-up the Gradio UI
|
142 |
# Add text box and radio button to the interface
|
|
|
125 |
# While writing to the log file, ensure that the commit scheduler is locked to avoid parallel
|
126 |
# access
|
127 |
|
128 |
+
with scheduler.lock:
|
129 |
+
with log_file.open("a") as f:
|
130 |
+
f.write(json.dumps(
|
131 |
+
{
|
132 |
+
'user_input': user_input,
|
133 |
+
'retrieved_context': context_for_query,
|
134 |
+
'model_response': prediction
|
135 |
+
}
|
136 |
+
))
|
137 |
+
f.write("\n")
|
138 |
+
|
139 |
+
return prediction
|
140 |
|
141 |
# Set-up the Gradio UI
|
142 |
# Add text box and radio button to the interface
|