Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -289,11 +289,11 @@ def summarize(inp,history,data=None):
|
|
| 289 |
new_data = out[s:e]
|
| 290 |
#yield "", [(inp,f'{mes}\n{new_history}')]
|
| 291 |
|
| 292 |
-
content = NEWS_REPORTER.format(new_data=str(new_data
|
| 293 |
stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 294 |
for response in stream:
|
| 295 |
resp += response.token.text
|
| 296 |
-
yield "", [(inp,resp)],
|
| 297 |
|
| 298 |
#for line in resp.split("\n"):
|
| 299 |
#if 'title:' in line.lower():
|
|
@@ -304,10 +304,9 @@ def summarize(inp,history,data=None):
|
|
| 304 |
out_box.append(out_json.strip("</s>"))
|
| 305 |
#out_box=out_box)
|
| 306 |
print("ADDING")
|
| 307 |
-
yield "", [(inp,resp)],out_box
|
| 308 |
-
|
| 309 |
e=e+chunk
|
| 310 |
s=s+chunk
|
|
|
|
| 311 |
|
| 312 |
#history = "preliminary result: {}\n".format(resp)
|
| 313 |
#yield "", (inp,f'{mes}\n{history}')
|
|
@@ -515,6 +514,7 @@ def load_html(conv):
|
|
| 515 |
|
| 516 |
|
| 517 |
with gr.Blocks() as app:
|
|
|
|
| 518 |
cb = gr.Chatbot(height=600, show_share_button=True, show_copy_button=True)
|
| 519 |
with gr.Row():
|
| 520 |
inst = gr.Textbox(label="Instructions")
|
|
@@ -533,5 +533,5 @@ with gr.Blocks() as app:
|
|
| 533 |
keyw.click(get_records,[inst,out_json],[inst,cb])
|
| 534 |
load_btn.click(load_data,rss_custom,[out_json,cb])
|
| 535 |
u_btn.click(find_rss,None,[out_json,cb,error_box])
|
| 536 |
-
sub_btn.click(summarize,[inst,cb,out_json],[inst,cb,error_box])
|
| 537 |
app.queue(default_concurrency_limit=20).launch()
|
|
|
|
| 289 |
new_data = out[s:e]
|
| 290 |
#yield "", [(inp,f'{mes}\n{new_history}')]
|
| 291 |
|
| 292 |
+
content = NEWS_REPORTER.format(new_data=str(new_data)
|
| 293 |
stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 294 |
for response in stream:
|
| 295 |
resp += response.token.text
|
| 296 |
+
yield "", [(inp,resp)],out_box
|
| 297 |
|
| 298 |
#for line in resp.split("\n"):
|
| 299 |
#if 'title:' in line.lower():
|
|
|
|
| 304 |
out_box.append(out_json.strip("</s>"))
|
| 305 |
#out_box=out_box)
|
| 306 |
print("ADDING")
|
|
|
|
|
|
|
| 307 |
e=e+chunk
|
| 308 |
s=s+chunk
|
| 309 |
+
yield "", [(inp,resp)],out_box
|
| 310 |
|
| 311 |
#history = "preliminary result: {}\n".format(resp)
|
| 312 |
#yield "", (inp,f'{mes}\n{history}')
|
|
|
|
| 514 |
|
| 515 |
|
| 516 |
with gr.Blocks() as app:
|
| 517 |
+
html_out=gr.HTML()
|
| 518 |
cb = gr.Chatbot(height=600, show_share_button=True, show_copy_button=True)
|
| 519 |
with gr.Row():
|
| 520 |
inst = gr.Textbox(label="Instructions")
|
|
|
|
| 533 |
keyw.click(get_records,[inst,out_json],[inst,cb])
|
| 534 |
load_btn.click(load_data,rss_custom,[out_json,cb])
|
| 535 |
u_btn.click(find_rss,None,[out_json,cb,error_box])
|
| 536 |
+
sub_btn.click(summarize,[inst,cb,out_json],[inst,cb,error_box]).then(load_html,error_box,html_out)
|
| 537 |
app.queue(default_concurrency_limit=20).launch()
|