Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,8 @@ import os
|
|
4 |
import sys
|
5 |
import logging
|
6 |
from pathlib import Path
|
7 |
-
from huggingface_hub import snapshot_download
|
|
|
8 |
import torch
|
9 |
import fire
|
10 |
import gradio as gr
|
@@ -69,7 +70,10 @@ def setup_model():
|
|
69 |
token=os.getenv("HF_TOKEN") # Add token if needed
|
70 |
)
|
71 |
break
|
72 |
-
except
|
|
|
|
|
|
|
73 |
if attempt == max_retries - 1:
|
74 |
logger.error(f"Failed to download model after {max_retries} attempts: {str(e)}")
|
75 |
raise
|
|
|
4 |
import sys
|
5 |
import logging
|
6 |
from pathlib import Path
|
7 |
+
from huggingface_hub import snapshot_download
|
8 |
+
from huggingface_hub.utils import RepositoryNotFoundError, HfHubError
|
9 |
import torch
|
10 |
import fire
|
11 |
import gradio as gr
|
|
|
70 |
token=os.getenv("HF_TOKEN") # Add token if needed
|
71 |
)
|
72 |
break
|
73 |
+
except RepositoryNotFoundError as e:
|
74 |
+
logger.error(f"Repository not found: {str(e)}")
|
75 |
+
raise
|
76 |
+
except Exception as e:
|
77 |
if attempt == max_retries - 1:
|
78 |
logger.error(f"Failed to download model after {max_retries} attempts: {str(e)}")
|
79 |
raise
|