Download app.py from fdbw/fzd13: direct link, hf CLI and curl.
- Browser
- Download file 589 Bytes
-
https://huggingface.co/spaces/fdbw/fzd13/resolve/main/app.py
- Command line
-
hf download hf://spaces/fdbw/fzd13/app.py
-
curl -L -o app.py https://huggingface.co/spaces/fdbw/fzd13/resolve/main/app.py
589 Bytes
| import gradio as gr | |
| import os | |
| def test_load(): | |
| files = os.listdir(".") | |
| if "genealogy.txt" not in files: | |
| return f"❌ 文件缺失!当前目录文件: {files}" | |
| try: | |
| with open("genealogy.txt", "r", encoding="utf-8") as f: | |
| lines = f.readlines() | |
| return f"✅ 成功读取 {len(lines)} 行" | |
| except Exception as e: | |
| return f"❌ 读取失败: {str(e)}" | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 调试模式") | |
| btn = gr.Button("检查 genealogy.txt") | |
| out = gr.Textbox() | |
| btn.click(test_load, outputs=out) | |
| demo.launch() |