Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -258,7 +258,7 @@ def summarize(inp,history,data=None):
|
|
258 |
task = "Compile a detailed report"
|
259 |
|
260 |
history.clear()
|
261 |
-
yield "",[(inp,"Working on it...")]
|
262 |
|
263 |
if data != "Error" and data != "":
|
264 |
timestamp=datetime.datetime.now()
|
@@ -292,7 +292,7 @@ def summarize(inp,history,data=None):
|
|
292 |
new_history=""
|
293 |
task = f'Compile this data to fulfill the task: {task}, and complete the purpose: {purpose}\n'
|
294 |
current_data=""
|
295 |
-
out_box
|
296 |
resp = ""
|
297 |
for z in range(divi):
|
298 |
print(f's:e :: {s}:{e}')
|
@@ -304,24 +304,27 @@ def summarize(inp,history,data=None):
|
|
304 |
stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
305 |
for response in stream:
|
306 |
resp += response.token.text
|
307 |
-
yield "", [(inp,resp)]
|
308 |
|
309 |
-
|
|
|
|
|
310 |
e=e+chunk
|
311 |
s=s+chunk
|
|
|
312 |
#history = "preliminary result: {}\n".format(resp)
|
313 |
#yield "", (inp,f'{mes}\n{history}')
|
314 |
-
print ("final" + resp)
|
315 |
-
out_hist = "result:\n{}".format(resp)
|
316 |
#return history
|
317 |
#yield "", [(inp,out_hist)]
|
318 |
|
319 |
-
out = str(out_hist)
|
320 |
#rawp = out
|
321 |
else:
|
322 |
rawp = "Provide a valid data source"
|
323 |
history.append((inp,rawp))
|
324 |
-
return "", history
|
325 |
|
326 |
|
327 |
def find_rss():
|
@@ -515,5 +518,5 @@ with gr.Blocks() as app:
|
|
515 |
keyw.click(get_records,[inst,out_json],[inst,cb])
|
516 |
load_btn.click(load_data,rss_custom,[out_json,cb])
|
517 |
u_btn.click(find_rss,None,[out_json,cb,error_box])
|
518 |
-
sub_btn.click(summarize,[inst,cb,out_json],[inst,cb])
|
519 |
app.queue(default_concurrency_limit=20).launch()
|
|
|
258 |
task = "Compile a detailed report"
|
259 |
|
260 |
history.clear()
|
261 |
+
yield "",[(inp,"Working on it...")],None
|
262 |
|
263 |
if data != "Error" and data != "":
|
264 |
timestamp=datetime.datetime.now()
|
|
|
292 |
new_history=""
|
293 |
task = f'Compile this data to fulfill the task: {task}, and complete the purpose: {purpose}\n'
|
294 |
current_data=""
|
295 |
+
out_box =[]
|
296 |
resp = ""
|
297 |
for z in range(divi):
|
298 |
print(f's:e :: {s}:{e}')
|
|
|
304 |
stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
305 |
for response in stream:
|
306 |
resp += response.token.text
|
307 |
+
yield "", [(inp,resp)],out_box
|
308 |
|
309 |
+
out_box.append(resp.strip("</s>")
|
310 |
+
yield "", [(inp,resp)],out_box
|
311 |
+
|
312 |
e=e+chunk
|
313 |
s=s+chunk
|
314 |
+
|
315 |
#history = "preliminary result: {}\n".format(resp)
|
316 |
#yield "", (inp,f'{mes}\n{history}')
|
317 |
+
#print ("final" + resp)
|
318 |
+
#out_hist = "result:\n{}".format(resp)
|
319 |
#return history
|
320 |
#yield "", [(inp,out_hist)]
|
321 |
|
322 |
+
#out = str(out_hist)
|
323 |
#rawp = out
|
324 |
else:
|
325 |
rawp = "Provide a valid data source"
|
326 |
history.append((inp,rawp))
|
327 |
+
return "", history,None
|
328 |
|
329 |
|
330 |
def find_rss():
|
|
|
518 |
keyw.click(get_records,[inst,out_json],[inst,cb])
|
519 |
load_btn.click(load_data,rss_custom,[out_json,cb])
|
520 |
u_btn.click(find_rss,None,[out_json,cb,error_box])
|
521 |
+
sub_btn.click(summarize,[inst,cb,out_json],[inst,cb,error_box])
|
522 |
app.queue(default_concurrency_limit=20).launch()
|