Skip to content

Commit 1bbc490

Browse files
committed
testing
1 parent 928010d commit 1bbc490

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed
2.42 KB
Binary file not shown.

Backend/test_sum.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import asyncio
77

8+
progress = "NULL" # just for tracking progress
89

910
def summary(text):
1011
# Load the summarization pipeline
@@ -18,6 +19,8 @@ def summary(text):
1819
chunks = [text[i:i + max_tokens_per_chunk] for i in range(0, len(text), max_tokens_per_chunk)]
1920
# for the exceptions
2021
exceptions = "NULL"
22+
global progress
23+
progress = 0
2124
# Generate summaries for each chunk
2225
summaries = []
2326
len_chunk=len(chunks)
@@ -31,7 +34,8 @@ def summary(text):
3134
summaries.append(summary[0]['summary_text']+"\n\n")
3235
print(summary[0]['summary_text'])
3336
print("\n \n STATUS:"+str(i+1)+"/"+str(len_chunk))
34-
print("\n \n COMPLETED:"+str((i+1)/len_chunk*100)+"%")
37+
progress = (i+1)/len_chunk*100
38+
print("\n \n COMPLETED:"+str(progress)+"%")
3539
except Exception as e:
3640
print(f"An error occurred while summarizing chunk {i}: {str(e)}")
3741
exceptions = "\n".join(f"An error occurred while summarizing chunk {i}: {str(e)}")
@@ -68,4 +72,7 @@ async def get_summary(file: UploadFile = File(...)):
6872
data = await gen_summary(file)
6973
return data
7074

71-
75+
@router_summariser.get("/summary-gen-progress")
76+
def get_summary_progress():
77+
global progress
78+
return {"status" : progress }

__pycache__/main.cpython-310.pyc

-2 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)