Spaces:
Running
Running
Update streamlit_app.py
Browse files- streamlit_app.py +7 -1
streamlit_app.py
CHANGED
|
@@ -33,7 +33,13 @@ def get_client(space_id: str, hf_token: Optional[str]) -> Client:
|
|
| 33 |
"""
|
| 34 |
Cache the gradio client so we do not re-create the session for each run.
|
| 35 |
"""
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
|
| 39 |
@dataclass
|
|
|
|
| 33 |
"""
|
| 34 |
Cache the gradio client so we do not re-create the session for each run.
|
| 35 |
"""
|
| 36 |
+
if not hf_token:
|
| 37 |
+
return Client(space_id)
|
| 38 |
+
# Gradio client renamed the token kwarg; try both for compatibility
|
| 39 |
+
try:
|
| 40 |
+
return Client(space_id, hf_token=hf_token)
|
| 41 |
+
except TypeError:
|
| 42 |
+
return Client(space_id, token=hf_token)
|
| 43 |
|
| 44 |
|
| 45 |
@dataclass
|