Namitg02 commited on
Commit
7d4f1e4
·
verified ·
1 Parent(s): 4aa5088

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -22
app.py CHANGED
@@ -122,12 +122,15 @@ def talk(prompt, history):
122
  global historylog
123
  # for user_message, bot_message in history[0:]:
124
  # historylog += f"<s>[INST] {user_message} [/INST] {bot_message} </s>"
125
- historylog += f"<s> {prompt} \n {response} </s>"
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
 
132
  # from huggingface_hub import HfApi
133
  # api = HfApi()
@@ -138,36 +141,18 @@ def talk(prompt, history):
138
  # repo_type="space"
139
  # )
140
 
141
- print("upload section passed")
142
-
143
-
144
-
145
-
146
 
147
  for i in range(len(response)):
148
  time.sleep(0.05)
149
  yield response[: i+1]
150
-
151
- # return(stream['choices'][0]['message']['content'])
152
-
153
- # text = ""
154
- # for output in stream:
155
- # text += output['choices'][0]['message']['content']
156
- # print(f"{output}")
157
- # print("check3H")
158
- # print(text)
159
- # yield text
160
-
161
-
162
 
163
  # calling the model to generate response based on message/ input
164
  # do_sample if set to True uses strategies to select the next token from the probability distribution over the entire vocabulary
165
  # temperature controls randomness. more renadomness with higher temperature
166
  # only the tokens comprising the top_p probability mass are considered for responses
167
  # This output is a data structure containing all the information returned by generate(), but that can also be used as tuple or dictionary.
168
-
169
 
170
-
171
  TITLE = "AI Copilot for Diabetes Patients"
172
 
173
  DESCRIPTION = "I provide answers to concerns related to Diabetes"
 
122
  global historylog
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
+ data = open('file.txt','w+')
130
+ data.write(str(historylog))
131
+ print(data.read())
132
+ data.close()
133
+
134
 
135
  # from huggingface_hub import HfApi
136
  # api = HfApi()
 
141
  # repo_type="space"
142
  # )
143
 
144
+ print("upload section passed")
 
 
 
 
145
 
146
  for i in range(len(response)):
147
  time.sleep(0.05)
148
  yield response[: i+1]
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  # calling the model to generate response based on message/ input
151
  # do_sample if set to True uses strategies to select the next token from the probability distribution over the entire vocabulary
152
  # temperature controls randomness. more renadomness with higher temperature
153
  # only the tokens comprising the top_p probability mass are considered for responses
154
  # This output is a data structure containing all the information returned by generate(), but that can also be used as tuple or dictionary.
 
155
 
 
156
  TITLE = "AI Copilot for Diabetes Patients"
157
 
158
  DESCRIPTION = "I provide answers to concerns related to Diabetes"