Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -117,12 +117,20 @@ class BasicAgent:
|
|
| 117 |
|
| 118 |
|
| 119 |
def _get_space_repo_id() -> str:
|
| 120 |
-
#
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
|
| 128 |
def run_and_submit_all(profile: gr.OAuthProfile | None) -> tuple[str, pd.DataFrame]:
|
|
|
|
| 117 |
|
| 118 |
|
| 119 |
def _get_space_repo_id() -> str:
|
| 120 |
+
# Preferred: full id
|
| 121 |
+
space_id = (os.getenv("SPACE_ID") or "").strip()
|
| 122 |
+
if space_id and "/" in space_id:
|
| 123 |
+
return space_id
|
| 124 |
+
|
| 125 |
+
# Fallback: author + repo name
|
| 126 |
+
author = (os.getenv("SPACE_AUTHOR_NAME") or "").strip()
|
| 127 |
+
repo = (os.getenv("SPACE_REPO_NAME") or "").strip()
|
| 128 |
+
if author and repo:
|
| 129 |
+
return f"{author}/{repo}"
|
| 130 |
+
|
| 131 |
+
# Fallback: host sometimes exists like "monkminer-final-assignment-template.hf.space"
|
| 132 |
+
# (Not always reversible reliably, so only last resort)
|
| 133 |
+
return ""
|
| 134 |
|
| 135 |
|
| 136 |
def run_and_submit_all(profile: gr.OAuthProfile | None) -> tuple[str, pd.DataFrame]:
|