Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -232,6 +232,7 @@ def compress_data(c, instruct, history):
|
|
232 |
#out+=resp
|
233 |
e=e+chunk
|
234 |
s=s+chunk
|
|
|
235 |
return out
|
236 |
|
237 |
|
@@ -356,6 +357,8 @@ def summarize(inp,history,data=None,files=None,url=None,pdf_url=None,pdf_batch=N
|
|
356 |
|
357 |
json_out = compress_data(c,inp,out)
|
358 |
#json_box.append(json_out)
|
|
|
|
|
359 |
|
360 |
#json_object = json.dumps(eval(json_out), indent=4)
|
361 |
#json_box.append(json_out)
|
@@ -391,17 +394,17 @@ def clear_fn():
|
|
391 |
|
392 |
def hf_write(inp,f_name="tmp1",repo_name="Omnibus/tmp1",token=tok):
|
393 |
uidd=uuid.uuid4()
|
394 |
-
with open(f"{uidd}.
|
395 |
f.write(str(inp))
|
396 |
|
397 |
api.upload_file(
|
398 |
-
path_or_fileobj=f"{uidd}.
|
399 |
-
path_in_repo=f"{f_name}.
|
400 |
repo_id=repo_name,
|
401 |
token=token,
|
402 |
repo_type="dataset",
|
403 |
)
|
404 |
-
os.remove(f"{uidd}.
|
405 |
|
406 |
|
407 |
|
|
|
232 |
#out+=resp
|
233 |
e=e+chunk
|
234 |
s=s+chunk
|
235 |
+
yield out
|
236 |
return out
|
237 |
|
238 |
|
|
|
357 |
|
358 |
json_out = compress_data(c,inp,out)
|
359 |
#json_box.append(json_out)
|
360 |
+
history.append(("",json_out))
|
361 |
+
yield "", history,error_box,json_out
|
362 |
|
363 |
#json_object = json.dumps(eval(json_out), indent=4)
|
364 |
#json_box.append(json_out)
|
|
|
394 |
|
395 |
def hf_write(inp,f_name="tmp1",repo_name="Omnibus/tmp1",token=tok):
|
396 |
uidd=uuid.uuid4()
|
397 |
+
with open(f"{uidd}.txt", "w") as f:
|
398 |
f.write(str(inp))
|
399 |
|
400 |
api.upload_file(
|
401 |
+
path_or_fileobj=f"{uidd}.txt",
|
402 |
+
path_in_repo=f"{f_name}.txt",
|
403 |
repo_id=repo_name,
|
404 |
token=token,
|
405 |
repo_type="dataset",
|
406 |
)
|
407 |
+
os.remove(f"{uidd}.txt")
|
408 |
|
409 |
|
410 |
|