Spaces:
Sleeping
Sleeping
Avoids typo error and raise warning
Browse files
app.py
CHANGED
|
@@ -47,10 +47,15 @@ def evaluate_model(task: str, space_url: str):
|
|
| 47 |
if "localhost" in space_url:
|
| 48 |
api_url = f"{space_url}/{task}"
|
| 49 |
else:
|
| 50 |
-
api_url = f"https://{space_url.lower().replace('/', '-')}.hf.space/{task}"
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
try:
|
| 56 |
# Make API call to the space
|
|
|
|
| 47 |
if "localhost" in space_url:
|
| 48 |
api_url = f"{space_url}/{task}"
|
| 49 |
else:
|
|
|
|
| 50 |
|
| 51 |
+
try:
|
| 52 |
+
info_space = api.space_info(repo_id=space_url)
|
| 53 |
+
except:
|
| 54 |
+
return None, None, None, gr.Warning(f"Space '{space_url}' not found, it needs to be in the format username/space-name")
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
host = info_space.host
|
| 58 |
+
api_url = f"{host}/{task}"
|
| 59 |
|
| 60 |
try:
|
| 61 |
# Make API call to the space
|