Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -203,18 +203,16 @@ def predict(inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
|
203 |
# TODO - make this parse out markdown so we can have similar interface
|
204 |
counter=0
|
205 |
for chunk in response.iter_lines():
|
206 |
-
|
207 |
if counter == 0:
|
208 |
counter+=1
|
209 |
continue
|
210 |
-
|
211 |
-
# check whether each line is non-empty
|
212 |
if chunk.decode() :
|
213 |
chunk = chunk.decode()
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
# break
|
218 |
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
219 |
if token_counter == 0:
|
220 |
history.append(" " + partial_words)
|
@@ -225,11 +223,11 @@ def predict(inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
|
225 |
|
226 |
|
227 |
|
228 |
-
df=pd.DataFrame()
|
229 |
-
if UseMemory:
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
#return history, df, basedir
|
234 |
|
235 |
|
|
|
203 |
# TODO - make this parse out markdown so we can have similar interface
|
204 |
counter=0
|
205 |
for chunk in response.iter_lines():
|
206 |
+
|
207 |
if counter == 0:
|
208 |
counter+=1
|
209 |
continue
|
210 |
+
|
|
|
211 |
if chunk.decode() :
|
212 |
chunk = chunk.decode()
|
213 |
+
|
214 |
+
if len(chunk) > 12 and "content" in json.loads(chunk[6:])['choices'][0]['delta']:
|
215 |
+
|
|
|
216 |
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
217 |
if token_counter == 0:
|
218 |
history.append(" " + partial_words)
|
|
|
223 |
|
224 |
|
225 |
|
226 |
+
#df=pd.DataFrame()
|
227 |
+
#if UseMemory:
|
228 |
+
# outputfileName = 'ChatGPT-RLHF-Memory.csv' # Test first time file create
|
229 |
+
# df = store_message(chat, history, outputfileName) # Save to dataset
|
230 |
+
# basedir = get_base(outputfileName)
|
231 |
#return history, df, basedir
|
232 |
|
233 |
|