Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,13 +16,14 @@ params = {
|
|
16 |
|
17 |
def save_log(task, to_save):
|
18 |
with open("logs.txt", "a") as log_file:
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
|
23 |
llm = AutoModelForCausalLM.from_pretrained("Aspik101/Llama-2-7b-chat-hf-pl-lora_GGML", model_type="llama")
|
24 |
|
25 |
-
with gr.Blocks(
|
26 |
chatbot = gr.Chatbot()
|
27 |
msg = gr.Textbox()
|
28 |
clear = gr.Button("Clear")
|
@@ -41,6 +42,7 @@ with gr.Blocks(allow_flagging="auto") as demo:
|
|
41 |
time.sleep(0.005)
|
42 |
yield history
|
43 |
|
|
|
44 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
45 |
bot, chatbot, chatbot
|
46 |
)
|
|
|
16 |
|
17 |
def save_log(task, to_save):
|
18 |
with open("logs.txt", "a") as log_file:
|
19 |
+
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
20 |
+
log_file.write(f"[{current_time}] - {task}: {to_save}\n")
|
21 |
+
print(to_save)
|
22 |
|
23 |
|
24 |
llm = AutoModelForCausalLM.from_pretrained("Aspik101/Llama-2-7b-chat-hf-pl-lora_GGML", model_type="llama")
|
25 |
|
26 |
+
with gr.Blocks() as demo:
|
27 |
chatbot = gr.Chatbot()
|
28 |
msg = gr.Textbox()
|
29 |
clear = gr.Button("Clear")
|
|
|
42 |
time.sleep(0.005)
|
43 |
yield history
|
44 |
|
45 |
+
save_log("answer", answer_save)
|
46 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
47 |
bot, chatbot, chatbot
|
48 |
)
|