Update app.py
Browse files
app.py
CHANGED
|
@@ -2,15 +2,23 @@ import gradio as gr
|
|
| 2 |
from datasets import load_dataset
|
| 3 |
import huggingface_hub as hh
|
| 4 |
from huggingface_hub import HfApi
|
|
|
|
| 5 |
import os
|
| 6 |
|
|
|
|
|
|
|
| 7 |
hh.login(token=os.environ['token'])
|
| 8 |
|
| 9 |
api = HfApi()
|
| 10 |
-
file_list = api.list_repo_files(repo_id=
|
| 11 |
|
| 12 |
print(file_list)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
def greet(name):
|
| 15 |
return "Hello " + name + "!!"
|
| 16 |
|
|
|
|
| 2 |
from datasets import load_dataset
|
| 3 |
import huggingface_hub as hh
|
| 4 |
from huggingface_hub import HfApi
|
| 5 |
+
from huggingface_hub import HfFileSystem
|
| 6 |
import os
|
| 7 |
|
| 8 |
+
repo_id = os.environ['repo_id']
|
| 9 |
+
|
| 10 |
hh.login(token=os.environ['token'])
|
| 11 |
|
| 12 |
api = HfApi()
|
| 13 |
+
file_list = api.list_repo_files(repo_id=repo_id, repo_type="space")
|
| 14 |
|
| 15 |
print(file_list)
|
| 16 |
|
| 17 |
+
fs = HfFileSystem()
|
| 18 |
+
with fs.open(f"spaces/{repo_id}/info/副脾_症状.txt") as f:
|
| 19 |
+
data = f.read()
|
| 20 |
+
print(data)
|
| 21 |
+
|
| 22 |
def greet(name):
|
| 23 |
return "Hello " + name + "!!"
|
| 24 |
|