Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,12 +78,16 @@ def check_resume(file):
|
|
| 78 |
return "⚠️ Please upload a file", ""
|
| 79 |
try:
|
| 80 |
file_ext = file.name.split(".")[-1].lower()
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
text = extract_text_from_file(file_bytes, file_ext)
|
| 83 |
if not text.strip():
|
| 84 |
return "⚠️ Could not extract text", ""
|
| 85 |
result = "\n".join(validate_resume(text))
|
| 86 |
-
return result, text[:1000] # first 1000 chars
|
| 87 |
except Exception as e:
|
| 88 |
return f"⚠️ Error: {str(e)}", ""
|
| 89 |
|
|
|
|
| 78 |
return "⚠️ Please upload a file", ""
|
| 79 |
try:
|
| 80 |
file_ext = file.name.split(".")[-1].lower()
|
| 81 |
+
|
| 82 |
+
# Gradio v3+ safe file reading
|
| 83 |
+
with open(file.name, "rb") as f:
|
| 84 |
+
file_bytes = f.read()
|
| 85 |
+
|
| 86 |
text = extract_text_from_file(file_bytes, file_ext)
|
| 87 |
if not text.strip():
|
| 88 |
return "⚠️ Could not extract text", ""
|
| 89 |
result = "\n".join(validate_resume(text))
|
| 90 |
+
return result, text[:1000] # show first 1000 chars
|
| 91 |
except Exception as e:
|
| 92 |
return f"⚠️ Error: {str(e)}", ""
|
| 93 |
|