Update app.py
Browse files
app.py
CHANGED
|
@@ -214,10 +214,6 @@ def construct_input_prompt(chat_history, message, personalized_data):
|
|
| 214 |
for user, assistant in chat_history:
|
| 215 |
input_prompt += f"{user} [/INST] {assistant} <s>[INST] "
|
| 216 |
input_prompt += f"{message} [/INST] "
|
| 217 |
-
print("FROM CONSTRUCT_INPUT_PROMPT")
|
| 218 |
-
print(f"THIS IS THE CHAT HISTORY: {chat_history}")
|
| 219 |
-
print(f"THIS IS THE MESSAGE: {message}")
|
| 220 |
-
print(f"THIS IS THE INPUT PROMPT: {input_prompt}")
|
| 221 |
return input_prompt
|
| 222 |
|
| 223 |
## trust-game-llama-2-7b-chat
|
|
@@ -296,7 +292,6 @@ def generate(
|
|
| 296 |
# Start the model generation thread
|
| 297 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
| 298 |
t.start()
|
| 299 |
-
print(f"this is the thread: {t}")
|
| 300 |
|
| 301 |
# Yield generated text chunks
|
| 302 |
outputs = []
|
|
@@ -345,20 +340,24 @@ def generate(
|
|
| 345 |
existing_data = pd.read_csv(data_file)
|
| 346 |
|
| 347 |
# Add timestamp, message and a readable sentence column
|
| 348 |
-
conversation_df = pd.DataFrame(conversation)
|
|
|
|
| 349 |
conversation_df['message'] = message
|
| 350 |
-
conversation_df['
|
| 351 |
conversation_df['readable_sentence'] = readable_sentence
|
| 352 |
-
|
|
|
|
| 353 |
# Append new conversation to existing data
|
| 354 |
updated_data = pd.concat([existing_data, conversation_df], ignore_index=True)
|
| 355 |
updated_data.to_csv(data_file, index=False)
|
| 356 |
else:
|
| 357 |
# If file doesn't exist, create new file with conversation data
|
| 358 |
-
conversation_df = pd.DataFrame(conversation)
|
|
|
|
| 359 |
conversation_df['message'] = message
|
| 360 |
-
conversation_df['
|
| 361 |
conversation_df['readable_sentence'] = readable_sentence
|
|
|
|
| 362 |
conversation_df.to_csv(data_file, index=False)
|
| 363 |
|
| 364 |
print("Updating .csv")
|
|
|
|
| 214 |
for user, assistant in chat_history:
|
| 215 |
input_prompt += f"{user} [/INST] {assistant} <s>[INST] "
|
| 216 |
input_prompt += f"{message} [/INST] "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
return input_prompt
|
| 218 |
|
| 219 |
## trust-game-llama-2-7b-chat
|
|
|
|
| 292 |
# Start the model generation thread
|
| 293 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
| 294 |
t.start()
|
|
|
|
| 295 |
|
| 296 |
# Yield generated text chunks
|
| 297 |
outputs = []
|
|
|
|
| 340 |
existing_data = pd.read_csv(data_file)
|
| 341 |
|
| 342 |
# Add timestamp, message and a readable sentence column
|
| 343 |
+
#conversation_df = pd.DataFrame(conversation)
|
| 344 |
+
conversation_df = pd.DataFrame()
|
| 345 |
conversation_df['message'] = message
|
| 346 |
+
conversation_df['input_prompt'] = input_prompt
|
| 347 |
conversation_df['readable_sentence'] = readable_sentence
|
| 348 |
+
conversation_df['timestamp'] = timestamp
|
| 349 |
+
|
| 350 |
# Append new conversation to existing data
|
| 351 |
updated_data = pd.concat([existing_data, conversation_df], ignore_index=True)
|
| 352 |
updated_data.to_csv(data_file, index=False)
|
| 353 |
else:
|
| 354 |
# If file doesn't exist, create new file with conversation data
|
| 355 |
+
#conversation_df = pd.DataFrame(conversation)
|
| 356 |
+
conversation_df = pd.DataFrame()
|
| 357 |
conversation_df['message'] = message
|
| 358 |
+
conversation_df['input_prompt'] = input_prompt
|
| 359 |
conversation_df['readable_sentence'] = readable_sentence
|
| 360 |
+
conversation_df['timestamp'] = timestamp
|
| 361 |
conversation_df.to_csv(data_file, index=False)
|
| 362 |
|
| 363 |
print("Updating .csv")
|