Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,6 @@ import os
|
|
| 16 |
HF_TOKEN = os.getenv('HF_Token')
|
| 17 |
#Log_Path="./Logfolder"
|
| 18 |
logfile = 'DiabetesChatLog.txt'
|
| 19 |
-
historylog = ''
|
| 20 |
|
| 21 |
data = load_dataset("Namitg02/Test", split='train', streaming=False)
|
| 22 |
#Returns a list of dictionaries, each representing a row in the dataset.
|
|
@@ -119,15 +118,17 @@ def talk(prompt, history):
|
|
| 119 |
print(stream['choices'][0]['message']['content'])
|
| 120 |
response = stream['choices'][0]['message']['content']
|
| 121 |
|
| 122 |
-
|
| 123 |
# for user_message, bot_message in history[0:]:
|
| 124 |
# historylog += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
|
|
|
|
| 125 |
historylog += f"{prompt} \n {response} "
|
| 126 |
print("history log")
|
| 127 |
print(str(historylog))
|
| 128 |
print("history log printed")
|
| 129 |
-
|
| 130 |
-
|
|
|
|
| 131 |
print(data.read())
|
| 132 |
data.close()
|
| 133 |
|
|
|
|
| 16 |
HF_TOKEN = os.getenv('HF_Token')
|
| 17 |
#Log_Path="./Logfolder"
|
| 18 |
logfile = 'DiabetesChatLog.txt'
|
|
|
|
| 19 |
|
| 20 |
data = load_dataset("Namitg02/Test", split='train', streaming=False)
|
| 21 |
#Returns a list of dictionaries, each representing a row in the dataset.
|
|
|
|
| 118 |
print(stream['choices'][0]['message']['content'])
|
| 119 |
response = stream['choices'][0]['message']['content']
|
| 120 |
|
| 121 |
+
|
| 122 |
# for user_message, bot_message in history[0:]:
|
| 123 |
# historylog += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
|
| 124 |
+
historylog = ''
|
| 125 |
historylog += f"{prompt} \n {response} "
|
| 126 |
print("history log")
|
| 127 |
print(str(historylog))
|
| 128 |
print("history log printed")
|
| 129 |
+
with open('file.txt', 'w+') as data:
|
| 130 |
+
data.write(str(historylog))
|
| 131 |
+
data.seek(0)
|
| 132 |
print(data.read())
|
| 133 |
data.close()
|
| 134 |
|