Spaces:
Runtime error
Runtime error
Commit ·
8ee1c86
1
Parent(s): 0be0145
fix(gradio): remove file_types constraint and redundant event listener to fix drag-and-drop
Browse files
app.py
CHANGED
|
@@ -54,7 +54,6 @@ with gr.Blocks(title="📄 MarkItDown 文件轉 Markdown 線上工具") as demo:
|
|
| 54 |
label="📁 請將檔案拖曳到此區域,或點擊選擇多個檔案",
|
| 55 |
file_count="multiple",
|
| 56 |
type="filepath",
|
| 57 |
-
file_types=[".txt", ".md", ".html", ".csv", ".json", ".xml", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", "image", "audio"],
|
| 58 |
height=150,
|
| 59 |
)
|
| 60 |
|
|
@@ -68,9 +67,8 @@ with gr.Blocks(title="📄 MarkItDown 文件轉 Markdown 線上工具") as demo:
|
|
| 68 |
show_label=False,
|
| 69 |
)
|
| 70 |
|
| 71 |
-
# 拖曳上傳或選擇檔案時自動觸發轉換 (
|
| 72 |
file_input.change(convert_file_to_md, inputs=file_input, outputs=output)
|
| 73 |
-
file_input.upload(convert_file_to_md, inputs=file_input, outputs=output)
|
| 74 |
|
| 75 |
|
| 76 |
if __name__ == "__main__":
|
|
|
|
| 54 |
label="📁 請將檔案拖曳到此區域,或點擊選擇多個檔案",
|
| 55 |
file_count="multiple",
|
| 56 |
type="filepath",
|
|
|
|
| 57 |
height=150,
|
| 58 |
)
|
| 59 |
|
|
|
|
| 67 |
show_label=False,
|
| 68 |
)
|
| 69 |
|
| 70 |
+
# 拖曳上傳或選擇檔案時自動觸發轉換 (只保留 change,避免與 upload 衝突導致 race condition)
|
| 71 |
file_input.change(convert_file_to_md, inputs=file_input, outputs=output)
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
if __name__ == "__main__":
|