Update app.py
Browse files
app.py
CHANGED
@@ -87,11 +87,11 @@ def format_prompt(prompt,retrieved_documents,k,history,memory_limit=3):
|
|
87 |
for user_message, bot_message in history[0:]:
|
88 |
PROMPT += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
|
89 |
print("checkwthhist2")
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
# historylog += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
|
93 |
-
|
94 |
-
# print(historylog)
|
95 |
return PROMPT
|
96 |
|
97 |
|
@@ -121,6 +121,7 @@ def talk(prompt, history):
|
|
121 |
stream = model.create_chat_completion(messages = messages, max_tokens=1000, stop=["</s>"], stream=False)
|
122 |
# print(f"{stream}")
|
123 |
print("check 7")
|
|
|
124 |
print(stream['choices'][0]['message']['content'])
|
125 |
return(stream['choices'][0]['message']['content'])
|
126 |
# text = ""
|
@@ -164,7 +165,7 @@ demo = gr.ChatInterface(
|
|
164 |
)
|
165 |
# launch chatbot and calls the talk function which in turn calls other functions
|
166 |
print("check14")
|
167 |
-
|
168 |
#memory_panda = pd.DataFrame(historylog)
|
169 |
#Logfile = Dataset.from_pandas(memory_panda)
|
170 |
#Logfile.push_to_hub("Namitg02/Logfile",token = HF_TOKEN)
|
|
|
87 |
for user_message, bot_message in history[0:]:
|
88 |
PROMPT += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
|
89 |
print("checkwthhist2")
|
90 |
+
global historylog
|
91 |
+
for user_message, bot_message in history[0:]:
|
92 |
+
historylog += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
|
93 |
|
94 |
+
print(historylog)
|
|
|
|
|
|
|
95 |
return PROMPT
|
96 |
|
97 |
|
|
|
121 |
stream = model.create_chat_completion(messages = messages, max_tokens=1000, stop=["</s>"], stream=False)
|
122 |
# print(f"{stream}")
|
123 |
print("check 7")
|
124 |
+
print(historylog)
|
125 |
print(stream['choices'][0]['message']['content'])
|
126 |
return(stream['choices'][0]['message']['content'])
|
127 |
# text = ""
|
|
|
165 |
)
|
166 |
# launch chatbot and calls the talk function which in turn calls other functions
|
167 |
print("check14")
|
168 |
+
|
169 |
#memory_panda = pd.DataFrame(historylog)
|
170 |
#Logfile = Dataset.from_pandas(memory_panda)
|
171 |
#Logfile.push_to_hub("Namitg02/Logfile",token = HF_TOKEN)
|