johann22 commited on
Commit
43600f7
·
verified ·
1 Parent(s): 0ab16c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -184,7 +184,7 @@ def compress_data(c, instruct, history, seed):
184
  return out
185
 
186
 
187
- def compress_data_og(c, instruct, history, seed):
188
  #seed=random.randint(1,1000000000)
189
 
190
  print (c)
@@ -230,7 +230,7 @@ def compress_data_og(c, instruct, history, seed):
230
 
231
 
232
 
233
- def summarize(inp,history,mem_check,seed=None,data=None):
234
  if seed==None or seed=="":
235
  seed=random.randint(1,1000000000)
236
  seed=int(seed)
@@ -268,7 +268,7 @@ def summarize(inp,history,mem_check,seed=None,data=None):
268
  if i == " " or i=="," or i=="\n" or i.isalpha()==True or i.isnumeric()==True:
269
  c +=1
270
  print (f'c2:: {c}')
271
- rawp = compress_data_og(c,inp,out,seed)
272
  history.clear()
273
  history.append((inp,rawp))
274
 
@@ -302,7 +302,8 @@ with gr.Blocks() as app:
302
  with gr.Column(scale=1):
303
  mem_check=gr.Checkbox(label="Memory", value=False)
304
  button=gr.Button()
305
-
 
306
  #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
307
  with gr.Row():
308
  stop_button=gr.Button("Stop")
@@ -319,6 +320,6 @@ with gr.Blocks() as app:
319
  #trans_btn.click(transcribe,[vid,lang,sz],trans)
320
  clear_btn.click(clear_fn,None,[prompt,chatbot])
321
  #go=button.click(transcribe,[vid,lang,sz],[trans,chatbot]).then(summarize,[prompt,chatbot,mem_check,trans],[prompt,chatbot,e_box,json_out])
322
- go=button.click(summarize,[prompt,chatbot,mem_check,blank_text,trans],[prompt,chatbot,e_box,json_out])
323
  stop_button.click(None,None,None,cancels=[go])
324
  app.queue(default_concurrency_limit=20).launch(show_api=True, show_error=True)
 
184
  return out
185
 
186
 
187
+ def compress_data_og(c, instruct, history, seed, MAX_DATA=MAX_DATA):
188
  #seed=random.randint(1,1000000000)
189
 
190
  print (c)
 
230
 
231
 
232
 
233
+ def summarize(inp,history,mem_check,seed=None,data=None,MAX_DATA=MAX_DATA):
234
  if seed==None or seed=="":
235
  seed=random.randint(1,1000000000)
236
  seed=int(seed)
 
268
  if i == " " or i=="," or i=="\n" or i.isalpha()==True or i.isnumeric()==True:
269
  c +=1
270
  print (f'c2:: {c}')
271
+ rawp = compress_data_og(c,inp,out,seed,MAX_DATA)
272
  history.clear()
273
  history.append((inp,rawp))
274
 
 
302
  with gr.Column(scale=1):
303
  mem_check=gr.Checkbox(label="Memory", value=False)
304
  button=gr.Button()
305
+ with gr.Row():
306
+ out_slider=gr.Slider(min=1000, max=100000, value=MAX_DATA)
307
  #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
308
  with gr.Row():
309
  stop_button=gr.Button("Stop")
 
320
  #trans_btn.click(transcribe,[vid,lang,sz],trans)
321
  clear_btn.click(clear_fn,None,[prompt,chatbot])
322
  #go=button.click(transcribe,[vid,lang,sz],[trans,chatbot]).then(summarize,[prompt,chatbot,mem_check,trans],[prompt,chatbot,e_box,json_out])
323
+ go=button.click(summarize,[prompt,chatbot,mem_check,blank_text,trans,out_slider],[prompt,chatbot,e_box,json_out])
324
  stop_button.click(None,None,None,cancels=[go])
325
  app.queue(default_concurrency_limit=20).launch(show_api=True, show_error=True)