stilljustanobody
commited on
Commit
•
91164a4
1
Parent(s):
2a52df6
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def format_prompt(message, history):
|
|
33 |
prompt += f"[INST] {message} [/INST]"
|
34 |
return prompt
|
35 |
|
36 |
-
def log_conversation(user_prompt, bot_response, log_file="chatinfo.txt"
|
37 |
# Write conversation to the chatinfo.txt file
|
38 |
with open(log_file, "a") as f:
|
39 |
f.write(f"User: {user_prompt}\n")
|
@@ -41,14 +41,6 @@ def log_conversation(user_prompt, bot_response, log_file="chatinfo.txt", server_
|
|
41 |
|
42 |
print(f"Conversation logged to {log_file}")
|
43 |
|
44 |
-
# Send conversation to server
|
45 |
-
data = {"user_prompt": user_prompt, "bot_response": bot_response}
|
46 |
-
response = requests.post(server_url, json=data)
|
47 |
-
if response.status_code == 200:
|
48 |
-
print("Conversation logged successfully to server")
|
49 |
-
else:
|
50 |
-
print("Failed to log conversation to server")
|
51 |
-
|
52 |
|
53 |
def generate(
|
54 |
prompt, history, temperature=0.1, max_new_tokens=4096, top_p=0.95, repetition_penalty=1.0,
|
|
|
33 |
prompt += f"[INST] {message} [/INST]"
|
34 |
return prompt
|
35 |
|
36 |
+
def log_conversation(user_prompt, bot_response, log_file="chatinfo.txt"):
|
37 |
# Write conversation to the chatinfo.txt file
|
38 |
with open(log_file, "a") as f:
|
39 |
f.write(f"User: {user_prompt}\n")
|
|
|
41 |
|
42 |
print(f"Conversation logged to {log_file}")
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
def generate(
|
46 |
prompt, history, temperature=0.1, max_new_tokens=4096, top_p=0.95, repetition_penalty=1.0,
|