LalitMahale
commited on
Commit
·
f5e4047
1
Parent(s):
f58e385
summarization api added
Browse files- app.py +3 -7
- utils/summary.py +1 -1
app.py
CHANGED
@@ -143,17 +143,13 @@ async def upload_base64(file_data: FileUploadRequest):
|
|
143 |
return {"text":summary}
|
144 |
else:
|
145 |
return {"text":f"{file_data.content_type} not supported"}
|
146 |
-
# with open(file_path, "rb") as f:
|
147 |
-
# content = f.read(100)
|
148 |
-
summary = "# working in *progress*.."
|
149 |
-
|
150 |
-
return {"text": summary}
|
151 |
-
|
152 |
except Exception as e:
|
153 |
import traceback
|
154 |
traceback.print_exc() # 🔥 Show full error in terminal
|
155 |
raise HTTPException(status_code=500, detail=str(e))
|
156 |
-
|
|
|
|
|
157 |
|
158 |
|
159 |
## RAG Chatbot
|
|
|
143 |
return {"text":summary}
|
144 |
else:
|
145 |
return {"text":f"{file_data.content_type} not supported"}
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
except Exception as e:
|
147 |
import traceback
|
148 |
traceback.print_exc() # 🔥 Show full error in terminal
|
149 |
raise HTTPException(status_code=500, detail=str(e))
|
150 |
+
finally :
|
151 |
+
if file_path:
|
152 |
+
os.remove(file_path)
|
153 |
|
154 |
|
155 |
## RAG Chatbot
|
utils/summary.py
CHANGED
@@ -14,7 +14,7 @@ class Summary:
|
|
14 |
|
15 |
def load_doc(self,doc_path:str):
|
16 |
try:
|
17 |
-
print("doc-path :",doc_path)
|
18 |
doc_loader = PyMuPDFLoader(file_path=doc_path)
|
19 |
return doc_loader.load()
|
20 |
except Exception as e:
|
|
|
14 |
|
15 |
def load_doc(self,doc_path:str):
|
16 |
try:
|
17 |
+
# print("doc-path :",doc_path)
|
18 |
doc_loader = PyMuPDFLoader(file_path=doc_path)
|
19 |
return doc_loader.load()
|
20 |
except Exception as e:
|