Update app.py
Browse files
app.py
CHANGED
|
@@ -36,10 +36,11 @@ def clone_from_ms(
|
|
| 36 |
|
| 37 |
def hf_list_repo_files(
|
| 38 |
hf_token: str,
|
| 39 |
-
hf_repo_id: str
|
|
|
|
| 40 |
):
|
| 41 |
hf_api = HfApi(token=hf_token)
|
| 42 |
-
files = hf_api.list_repo_files(repo_id=hf_repo_id)
|
| 43 |
return files
|
| 44 |
|
| 45 |
|
|
@@ -166,11 +167,12 @@ def push_to_ms(
|
|
| 166 |
def handle(
|
| 167 |
hf_token: str,
|
| 168 |
ms_token: str,
|
|
|
|
| 169 |
hf_repo: str,
|
| 170 |
ms_repo: str,
|
| 171 |
):
|
| 172 |
clone_dir = ms_repo.split("/")[-1]
|
| 173 |
-
hf_file_list = hf_list_repo_files(hf_token, hf_repo)
|
| 174 |
print(f"all file in hf: {hf_file_list}")
|
| 175 |
# file_paths = []
|
| 176 |
# for idx in range(100):
|
|
@@ -205,6 +207,7 @@ with gr.Blocks() as demo:
|
|
| 205 |
)
|
| 206 |
hf_token = gr.Textbox(label="HuggingFace Token")
|
| 207 |
ms_token = gr.Textbox(label="ModelScope Git Token")
|
|
|
|
| 208 |
hf_repo = gr.Textbox(label="HuggingFace Repo")
|
| 209 |
ms_repo = gr.Textbox(label="ModelScope Repo")
|
| 210 |
|
|
@@ -220,7 +223,7 @@ with gr.Blocks() as demo:
|
|
| 220 |
|
| 221 |
button.click(
|
| 222 |
handle,
|
| 223 |
-
[hf_token, ms_token, hf_repo, ms_repo],
|
| 224 |
outputs=None
|
| 225 |
)
|
| 226 |
|
|
|
|
| 36 |
|
| 37 |
def hf_list_repo_files(
|
| 38 |
hf_token: str,
|
| 39 |
+
hf_repo_id: str,
|
| 40 |
+
repo_type: str = "dataset"
|
| 41 |
):
|
| 42 |
hf_api = HfApi(token=hf_token)
|
| 43 |
+
files = hf_api.list_repo_files(repo_id=hf_repo_id, repo_type=repo_type)
|
| 44 |
return files
|
| 45 |
|
| 46 |
|
|
|
|
| 167 |
def handle(
|
| 168 |
hf_token: str,
|
| 169 |
ms_token: str,
|
| 170 |
+
repo_type: str,
|
| 171 |
hf_repo: str,
|
| 172 |
ms_repo: str,
|
| 173 |
):
|
| 174 |
clone_dir = ms_repo.split("/")[-1]
|
| 175 |
+
hf_file_list = hf_list_repo_files(hf_token, hf_repo, repo_type)
|
| 176 |
print(f"all file in hf: {hf_file_list}")
|
| 177 |
# file_paths = []
|
| 178 |
# for idx in range(100):
|
|
|
|
| 207 |
)
|
| 208 |
hf_token = gr.Textbox(label="HuggingFace Token")
|
| 209 |
ms_token = gr.Textbox(label="ModelScope Git Token")
|
| 210 |
+
repo_type = gr.Textbox(label="Repo Type", default="dataset")
|
| 211 |
hf_repo = gr.Textbox(label="HuggingFace Repo")
|
| 212 |
ms_repo = gr.Textbox(label="ModelScope Repo")
|
| 213 |
|
|
|
|
| 223 |
|
| 224 |
button.click(
|
| 225 |
handle,
|
| 226 |
+
[hf_token, ms_token, repo_type, hf_repo, ms_repo],
|
| 227 |
outputs=None
|
| 228 |
)
|
| 229 |
|