Spaces:
Sleeping
Sleeping
raise
Browse files
app.py
CHANGED
@@ -46,15 +46,18 @@ you've downloaded from your Kaggle user account.
|
|
46 |
|
47 |
|
48 |
def import_model(kaggle_model: str, repo_name: str, token: str) -> Iterable[List[Log]]:
|
|
|
|
|
49 |
if not kaggle_model:
|
50 |
-
|
|
|
51 |
if not repo_name:
|
52 |
repo_name = kaggle_model.split("/")[-1]
|
53 |
if not token:
|
54 |
-
|
|
|
55 |
api = HfApi(token=token)
|
56 |
|
57 |
-
runner = LogsViewRunner()
|
58 |
|
59 |
yield runner.log(f"Creating HF repo {repo_name}")
|
60 |
repo_url = api.create_repo(repo_name, exist_ok=True)
|
|
|
46 |
|
47 |
|
48 |
def import_model(kaggle_model: str, repo_name: str, token: str) -> Iterable[List[Log]]:
|
49 |
+
runner = LogsViewRunner()
|
50 |
+
|
51 |
if not kaggle_model:
|
52 |
+
yield runner.log("Kaggle model is required.", level="ERROR")
|
53 |
+
raise gr.Error("Kaggle model is required.")
|
54 |
if not repo_name:
|
55 |
repo_name = kaggle_model.split("/")[-1]
|
56 |
if not token:
|
57 |
+
yield runner.log("HF Write Token is required.", level="ERROR")
|
58 |
+
raise gr.Error("HF Write Token is required.")
|
59 |
api = HfApi(token=token)
|
60 |
|
|
|
61 |
|
62 |
yield runner.log(f"Creating HF repo {repo_name}")
|
63 |
repo_url = api.create_repo(repo_name, exist_ok=True)
|