| import gradio as gr | |
| from datasets import load_dataset | |
| import huggingface_hub as hh | |
| from huggingface_hub import HfApi | |
| from huggingface_hub import HfFileSystem | |
| import os | |
| repo_id = os.environ['repo_id'] | |
| hh.login(token=os.environ['token']) | |
| api = HfApi() | |
| file_list = api.list_repo_files(repo_id=repo_id, repo_type="space") | |
| print(file_list) | |
| fs = HfFileSystem() | |
| with fs.open(f"spaces/{repo_id}/info/副脾_症状.txt") as f: | |
| data = f.read().decode() | |
| print(data) | |
| def greet(name): | |
| return "Hello " + name + "!!" | |
| iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| iface.launch() |