Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,8 @@ def admin_mode(password, file):
|
|
24 |
if file is None:
|
25 |
return "請上傳一個 Excel 文件。"
|
26 |
try:
|
27 |
-
# 讀取 Excel 文件
|
28 |
-
df = pd.read_excel(file)
|
29 |
# 提取 "Output" 和 "Initial Output" 列並返回第一行
|
30 |
output_first_line = parse_markdown(str(df["Output"].iloc[0])) if "Output" in df.columns else "Output 列不存在。"
|
31 |
initial_output_first_line = parse_markdown(str(df["Initial Output"].iloc[0])) if "Initial Output" in df.columns else "Initial Output 列不存在。"
|
@@ -40,7 +40,7 @@ def user_mode():
|
|
40 |
if not os.path.exists(default_excel_path):
|
41 |
return "預設的 Excel 文件不存在。"
|
42 |
try:
|
43 |
-
# 讀取 Excel 文件
|
44 |
df = pd.read_excel(default_excel_path)
|
45 |
# 提取 "Output" 和 "Initial Output" 列並返回第一行
|
46 |
output_first_line = parse_markdown(str(df["Output"].iloc[0])) if "Output" in df.columns else "Output 列不存在。"
|
|
|
24 |
if file is None:
|
25 |
return "請上傳一個 Excel 文件。"
|
26 |
try:
|
27 |
+
# 使用 pandas 讀取 Excel 文件
|
28 |
+
df = pd.read_excel(file.name) # `file.name` 是文件的路徑
|
29 |
# 提取 "Output" 和 "Initial Output" 列並返回第一行
|
30 |
output_first_line = parse_markdown(str(df["Output"].iloc[0])) if "Output" in df.columns else "Output 列不存在。"
|
31 |
initial_output_first_line = parse_markdown(str(df["Initial Output"].iloc[0])) if "Initial Output" in df.columns else "Initial Output 列不存在。"
|
|
|
40 |
if not os.path.exists(default_excel_path):
|
41 |
return "預設的 Excel 文件不存在。"
|
42 |
try:
|
43 |
+
# 使用 pandas 讀取 Excel 文件
|
44 |
df = pd.read_excel(default_excel_path)
|
45 |
# 提取 "Output" 和 "Initial Output" 列並返回第一行
|
46 |
output_first_line = parse_markdown(str(df["Output"].iloc[0])) if "Output" in df.columns else "Output 列不存在。"
|