Spaces:
Sleeping
Sleeping
Commit ·
d7222fd
1
Parent(s): 68964ff
restore old simple ui on portfolio route and make pdf optional
Browse files- app/routes/generate.py +14 -10
app/routes/generate.py
CHANGED
|
@@ -21,18 +21,22 @@ async def generate_portfolio(
|
|
| 21 |
user_id: str = Form("anonymous"),
|
| 22 |
username: str = Form("user"),
|
| 23 |
full_name: str = Form(""),
|
| 24 |
-
linkedin_pdf: UploadFile = File(
|
| 25 |
):
|
| 26 |
try:
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
print(f"DEBUG: Fetching GitHub data for {github_url}")
|
| 38 |
try:
|
|
|
|
| 21 |
user_id: str = Form("anonymous"),
|
| 22 |
username: str = Form("user"),
|
| 23 |
full_name: str = Form(""),
|
| 24 |
+
linkedin_pdf: UploadFile = File(None)
|
| 25 |
):
|
| 26 |
try:
|
| 27 |
+
linkedin_text = ""
|
| 28 |
+
linkedin_sections = {"full_text": ""}
|
| 29 |
+
if linkedin_pdf is not None and linkedin_pdf.filename:
|
| 30 |
+
pdf_bytes = await linkedin_pdf.read()
|
| 31 |
+
print(f"DEBUG: Processing PDF ({len(pdf_bytes)} bytes)")
|
| 32 |
+
try:
|
| 33 |
+
linkedin_text = extract_text_from_pdf(pdf_bytes)
|
| 34 |
+
linkedin_sections = extract_linkedin_sections(linkedin_text)
|
| 35 |
+
print(f"DEBUG: Extracted LinkedIn sections. Text length: {len(linkedin_text)}")
|
| 36 |
+
except Exception as pdf_err:
|
| 37 |
+
print(f"DEBUG: PDF Extraction Error: {str(pdf_err)}")
|
| 38 |
+
# We can ignore the error if PDF was optional, or return error depending on strictness
|
| 39 |
+
print("WARNING: Ignoring invalid PDF and proceeding without it.")
|
| 40 |
|
| 41 |
print(f"DEBUG: Fetching GitHub data for {github_url}")
|
| 42 |
try:
|