Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,14 @@ import gradio as gr
|
|
| 2 |
|
| 3 |
# Function to convert standard Space ID to Direct App URL
|
| 4 |
def get_embed_url(space_id):
|
| 5 |
-
# 1.
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
return f"https://{domain_friendly_id}.hf.space"
|
| 10 |
|
| 11 |
spaces_list = [
|
|
|
|
| 2 |
|
| 3 |
# Function to convert standard Space ID to Direct App URL
|
| 4 |
def get_embed_url(space_id):
|
| 5 |
+
# 1. Convert to lowercase (Domains must be lowercase)
|
| 6 |
+
lower_id = space_id.lower()
|
| 7 |
+
|
| 8 |
+
# 2. Replace slash '/' with hyphen '-'
|
| 9 |
+
# 3. CRITICAL FIX: Replace underscore '_' with hyphen '-'
|
| 10 |
+
# Because subdomains cannot contain underscores
|
| 11 |
+
domain_friendly_id = lower_id.replace("/", "-").replace("_", "-")
|
| 12 |
+
|
| 13 |
return f"https://{domain_friendly_id}.hf.space"
|
| 14 |
|
| 15 |
spaces_list = [
|