Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
| 3 |
|
| 4 |
"""
|
| 5 |
For more information on huggingface_hub Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
@@ -49,7 +51,8 @@ def log_interaction(message, response, history, system_message):
|
|
| 49 |
"history": history,
|
| 50 |
"system_message": system_message
|
| 51 |
}
|
| 52 |
-
|
|
|
|
| 53 |
logfile.write(json.dumps(log_data) + "\n")
|
| 54 |
|
| 55 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
@@ -90,4 +93,4 @@ demo = gr.ChatInterface(
|
|
| 90 |
)
|
| 91 |
|
| 92 |
if __name__ == "__main__":
|
| 93 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
"""
|
| 7 |
For more information on huggingface_hub Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
|
| 51 |
"history": history,
|
| 52 |
"system_message": system_message
|
| 53 |
}
|
| 54 |
+
os.makedirs("woodsj/student_interactions", exist_ok=True)
|
| 55 |
+
with open("woodsj/student_interactions/interaction_logs.jsonl", "a") as logfile:
|
| 56 |
logfile.write(json.dumps(log_data) + "\n")
|
| 57 |
|
| 58 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
|
|
| 93 |
)
|
| 94 |
|
| 95 |
if __name__ == "__main__":
|
| 96 |
+
demo.launch()
|