Spaces:
Sleeping
Sleeping
HTTP exception
Browse files
app.py
CHANGED
@@ -72,11 +72,12 @@ def extract_text_from_pdf(pdf_url):
|
|
72 |
os.remove(temp_pdf_path)
|
73 |
return text
|
74 |
except Exception as e:
|
75 |
-
raise
|
|
|
76 |
|
77 |
@spaces.GPU
|
78 |
def predict_text(text, url = 'https://arinsight.co/2024_FA_AEC_1200_GR1_GR2.pdf'):
|
79 |
-
pdf_text = extract_text_from_pdf(
|
80 |
text_combined = text + "\n\nExtracted Text from PDF:\n" + pdf_text
|
81 |
# Prepare the input messages
|
82 |
messages = [{"role": "user", "content": [{"type": "text", "text": text_combined}]}]
|
|
|
72 |
os.remove(temp_pdf_path)
|
73 |
return text
|
74 |
except Exception as e:
|
75 |
+
raise ValueError(f"Error extracting text from PDF: {str(e)}")
|
76 |
+
# raise HTTPException(status_code=400, detail=f"Error extracting text from PDF: {str(e)}")
|
77 |
|
78 |
@spaces.GPU
|
79 |
def predict_text(text, url = 'https://arinsight.co/2024_FA_AEC_1200_GR1_GR2.pdf'):
|
80 |
+
pdf_text = extract_text_from_pdf('https://arinsight.co/2024_FA_AEC_1200_GR1_GR2.pdf')
|
81 |
text_combined = text + "\n\nExtracted Text from PDF:\n" + pdf_text
|
82 |
# Prepare the input messages
|
83 |
messages = [{"role": "user", "content": [{"type": "text", "text": text_combined}]}]
|