Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import re
|
|
| 4 |
|
| 5 |
def check_spacing(csv_file):
|
| 6 |
# 讀取 CSV 檔案
|
| 7 |
-
df = pd.read_csv(csv_file)
|
| 8 |
|
| 9 |
# 將所有的內容合併成一個大的字串進行檢查
|
| 10 |
text = ' '.join(df.astype(str).values.flatten())
|
|
@@ -30,7 +30,7 @@ def check_spacing(csv_file):
|
|
| 30 |
# 使用 Gradio 來建立介面
|
| 31 |
interface = gr.Interface(
|
| 32 |
fn=check_spacing,
|
| 33 |
-
inputs=gr.
|
| 34 |
outputs="text",
|
| 35 |
title="中文校對系統",
|
| 36 |
description="上傳一個CSV檔案,系統會檢查$符號前後的中文字是否有空格"
|
|
|
|
| 4 |
|
| 5 |
def check_spacing(csv_file):
|
| 6 |
# 讀取 CSV 檔案
|
| 7 |
+
df = pd.read_csv(csv_file.name)
|
| 8 |
|
| 9 |
# 將所有的內容合併成一個大的字串進行檢查
|
| 10 |
text = ' '.join(df.astype(str).values.flatten())
|
|
|
|
| 30 |
# 使用 Gradio 來建立介面
|
| 31 |
interface = gr.Interface(
|
| 32 |
fn=check_spacing,
|
| 33 |
+
inputs=gr.File(file_types=['text/csv']),
|
| 34 |
outputs="text",
|
| 35 |
title="中文校對系統",
|
| 36 |
description="上傳一個CSV檔案,系統會檢查$符號前後的中文字是否有空格"
|