Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ def process_input(file, text, selected_lang):
|
|
| 15 |
|
| 16 |
# 输入优先级: 文件 > 文本
|
| 17 |
if file:
|
| 18 |
-
ext = os.path.splitext(file)[-1].lower()
|
| 19 |
|
| 20 |
if ext in [".txt", ".pdf", ".docx"]:
|
| 21 |
try:
|
|
@@ -44,7 +44,7 @@ def process_input(file, text, selected_lang):
|
|
| 44 |
return "❌ Unsupported file type"
|
| 45 |
|
| 46 |
# 如果没有上传文件,但用户输入了文本
|
| 47 |
-
elif text.strip():
|
| 48 |
lang = selected_lang if selected_lang != "auto" else detect(text)
|
| 49 |
print(f"[DEBUG] 使用语言: {lang}")
|
| 50 |
try:
|
|
|
|
| 15 |
|
| 16 |
# 输入优先级: 文件 > 文本
|
| 17 |
if file:
|
| 18 |
+
ext = os.path.splitext(file.name)[-1].lower()
|
| 19 |
|
| 20 |
if ext in [".txt", ".pdf", ".docx"]:
|
| 21 |
try:
|
|
|
|
| 44 |
return "❌ Unsupported file type"
|
| 45 |
|
| 46 |
# 如果没有上传文件,但用户输入了文本
|
| 47 |
+
elif text and text.strip():
|
| 48 |
lang = selected_lang if selected_lang != "auto" else detect(text)
|
| 49 |
print(f"[DEBUG] 使用语言: {lang}")
|
| 50 |
try:
|