Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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)
|
|
@@ -222,7 +222,9 @@ def compress_data_og(c, instruct, history, seed, MAX_DATA=MAX_DATA):
|
|
| 222 |
print (resp)
|
| 223 |
#out+=resp
|
| 224 |
e=e+chunk
|
| 225 |
-
s
|
|
|
|
|
|
|
| 226 |
|
| 227 |
print ("final" + resp)
|
| 228 |
#history = "observation: {}\n".format(resp)
|
|
@@ -230,7 +232,7 @@ def compress_data_og(c, instruct, history, seed, MAX_DATA=MAX_DATA):
|
|
| 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 +270,7 @@ def summarize(inp,history,mem_check,seed=None,data=None,MAX_DATA=MAX_DATA):
|
|
| 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 |
|
|
@@ -320,6 +322,6 @@ with gr.Blocks() as app:
|
|
| 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
|
| 324 |
stop_button.click(None,None,None,cancels=[go])
|
| 325 |
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):
|
| 188 |
#seed=random.randint(1,1000000000)
|
| 189 |
|
| 190 |
print (c)
|
|
|
|
| 222 |
print (resp)
|
| 223 |
#out+=resp
|
| 224 |
e=e+chunk
|
| 225 |
+
if s>1000:
|
| 226 |
+
s=s+chunk-1000
|
| 227 |
+
else: s=s+chunk
|
| 228 |
|
| 229 |
print ("final" + resp)
|
| 230 |
#history = "observation: {}\n".format(resp)
|
|
|
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
+
def summarize(inp,history,mem_check,seed=None,data=None):
|
| 236 |
if seed==None or seed=="":
|
| 237 |
seed=random.randint(1,1000000000)
|
| 238 |
seed=int(seed)
|
|
|
|
| 270 |
if i == " " or i=="," or i=="\n" or i.isalpha()==True or i.isnumeric()==True:
|
| 271 |
c +=1
|
| 272 |
print (f'c2:: {c}')
|
| 273 |
+
rawp = compress_data_og(c,inp,out,seed)
|
| 274 |
history.clear()
|
| 275 |
history.append((inp,rawp))
|
| 276 |
|
|
|
|
| 322 |
#trans_btn.click(transcribe,[vid,lang,sz],trans)
|
| 323 |
clear_btn.click(clear_fn,None,[prompt,chatbot])
|
| 324 |
#go=button.click(transcribe,[vid,lang,sz],[trans,chatbot]).then(summarize,[prompt,chatbot,mem_check,trans],[prompt,chatbot,e_box,json_out])
|
| 325 |
+
go=button.click(summarize,[prompt,chatbot,mem_check,blank_text,trans],[prompt,chatbot,e_box,json_out])
|
| 326 |
stop_button.click(None,None,None,cancels=[go])
|
| 327 |
app.queue(default_concurrency_limit=20).launch(show_api=True, show_error=True)
|