Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1488,7 +1488,12 @@ def run_document_analysis(file, progress=gr.Progress()):
|
|
| 1488 |
if file is None:
|
| 1489 |
return "<div style='padding:20px;text-align:center;color:#888;'>π νμΌμ μ
λ‘λνμΈμ (PDF, DOCX, HWP, HWPX, TXT)</div>", "", None
|
| 1490 |
|
| 1491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1492 |
fname = os.path.basename(file_path)
|
| 1493 |
progress(0.05, f"π {fname} μ½λ μ€...")
|
| 1494 |
|
|
@@ -1738,10 +1743,15 @@ def extract_file_text_api(file):
|
|
| 1738 |
"""νμΌ μ
λ‘λ β ν
μ€νΈ μΆμΆ API (ν1~4μ©)"""
|
| 1739 |
if file is None:
|
| 1740 |
return "β οΈ νμΌμ΄ μμ΅λλ€."
|
| 1741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1742 |
if not os.path.exists(file_path):
|
| 1743 |
-
return "β οΈ νμΌμ μ°Ύμ μ μμ΅λλ€."
|
| 1744 |
-
ext = Path(file_path).suffix.lower()
|
| 1745 |
fname = os.path.basename(file_path)
|
| 1746 |
sections, full_text, error = extract_text_from_file(file_path)
|
| 1747 |
if error:
|
|
|
|
| 1488 |
if file is None:
|
| 1489 |
return "<div style='padding:20px;text-align:center;color:#888;'>π νμΌμ μ
λ‘λνμΈμ (PDF, DOCX, HWP, HWPX, TXT)</div>", "", None
|
| 1490 |
|
| 1491 |
+
if hasattr(file, 'path'):
|
| 1492 |
+
file_path = file.path
|
| 1493 |
+
elif hasattr(file, 'name'):
|
| 1494 |
+
file_path = file.name
|
| 1495 |
+
else:
|
| 1496 |
+
file_path = str(file)
|
| 1497 |
fname = os.path.basename(file_path)
|
| 1498 |
progress(0.05, f"π {fname} μ½λ μ€...")
|
| 1499 |
|
|
|
|
| 1743 |
"""νμΌ μ
λ‘λ β ν
μ€νΈ μΆμΆ API (ν1~4μ©)"""
|
| 1744 |
if file is None:
|
| 1745 |
return "β οΈ νμΌμ΄ μμ΅λλ€."
|
| 1746 |
+
# Gradio 6.x: FileData κ°μ²΄ / NamedString / str λͺ¨λ μ²λ¦¬
|
| 1747 |
+
if hasattr(file, 'path'):
|
| 1748 |
+
file_path = file.path
|
| 1749 |
+
elif hasattr(file, 'name'):
|
| 1750 |
+
file_path = file.name
|
| 1751 |
+
else:
|
| 1752 |
+
file_path = str(file)
|
| 1753 |
if not os.path.exists(file_path):
|
| 1754 |
+
return f"β οΈ νμΌμ μ°Ύμ μ μμ΅λλ€: {os.path.basename(file_path)}"
|
|
|
|
| 1755 |
fname = os.path.basename(file_path)
|
| 1756 |
sections, full_text, error = extract_text_from_file(file_path)
|
| 1757 |
if error:
|