File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 5
5
import os
6
6
import asyncio
7
7
8
- progress = "NULL" # just for tracking progress
8
+ progress = None # just for tracking progress
9
9
10
10
def summary (text ):
11
11
# Load the summarization pipeline
@@ -72,7 +72,14 @@ async def get_summary(file: UploadFile = File(...)):
72
72
data = await gen_summary (file )
73
73
return data
74
74
75
- @router_summariser .get ("/summary-gen-progress" )
75
+ @router_summariser .get ("/summary-gen-progress" ) # route to track progress of summarization
76
76
def get_summary_progress ():
77
77
global progress
78
- return {"status" : progress }
78
+ if progress is None :
79
+ return {"status" : "No summarisation process in progress" }
80
+ elif progress == 100 :
81
+ return {"status" : "Completed" , "value" : progress }
82
+ elif progress in range (0 ,101 ) :
83
+ return {"status" : progress }
84
+ else :
85
+ return {"invalid data detected" }
You can’t perform that action at this time.
0 commit comments