Spaces:
Running
Running
chabane
commited on
Commit
·
fc61dfc
1
Parent(s):
3f39d9f
check for plot
Browse files
main.py
CHANGED
|
@@ -30,7 +30,7 @@ try:
|
|
| 30 |
blip_dir = "./models/blip-base-tf"
|
| 31 |
snapshot_download("Salesforce/blip-image-captioning-base", local_dir=blip_dir, local_dir_use_symlinks=False)
|
| 32 |
interpreter = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
| 33 |
-
print("[Info] Salesforce/blip-image-captioning-base is
|
| 34 |
except Exception as exp:
|
| 35 |
print("Can't load the model Salesforce/blip-image-captioning-base")
|
| 36 |
print(f"[Error] {str(exp)}")
|
|
@@ -110,6 +110,7 @@ def interpret(file_img:UploadFile=File(...)):
|
|
| 110 |
@app.post("/summerize")
|
| 111 |
def summerzation(file:UploadFile=File(...)):
|
| 112 |
try:
|
|
|
|
| 113 |
extension = file.filename.split(".")[-1]
|
| 114 |
supported_ext=["pdf","xlsx","docx","ppt"]
|
| 115 |
if extension not in supported_ext :
|
|
@@ -118,7 +119,6 @@ def summerzation(file:UploadFile=File(...)):
|
|
| 118 |
|
| 119 |
if len(file_bytes) > MAX_SIZE :
|
| 120 |
return JSONResponse(content={"error": "too large file "},status_code=400)
|
| 121 |
-
file.size()
|
| 122 |
if extension == "pdf":
|
| 123 |
text = get_text_from_PDF(file_bytes)
|
| 124 |
elif extension == "docx":
|
|
|
|
| 30 |
blip_dir = "./models/blip-base-tf"
|
| 31 |
snapshot_download("Salesforce/blip-image-captioning-base", local_dir=blip_dir, local_dir_use_symlinks=False)
|
| 32 |
interpreter = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
| 33 |
+
print("[Info] Salesforce/blip-image-captioning-base is installed.")
|
| 34 |
except Exception as exp:
|
| 35 |
print("Can't load the model Salesforce/blip-image-captioning-base")
|
| 36 |
print(f"[Error] {str(exp)}")
|
|
|
|
| 110 |
@app.post("/summerize")
|
| 111 |
def summerzation(file:UploadFile=File(...)):
|
| 112 |
try:
|
| 113 |
+
print(file.size)
|
| 114 |
extension = file.filename.split(".")[-1]
|
| 115 |
supported_ext=["pdf","xlsx","docx","ppt"]
|
| 116 |
if extension not in supported_ext :
|
|
|
|
| 119 |
|
| 120 |
if len(file_bytes) > MAX_SIZE :
|
| 121 |
return JSONResponse(content={"error": "too large file "},status_code=400)
|
|
|
|
| 122 |
if extension == "pdf":
|
| 123 |
text = get_text_from_PDF(file_bytes)
|
| 124 |
elif extension == "docx":
|