dream2589632147 commited on
Commit
36deab8
·
verified ·
1 Parent(s): 1a89101

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
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. Replace slash with hyphen
6
- # 2. Convert to lowercase (HF domains are lowercase)
7
- # 3. Add the .hf.space domain
8
- domain_friendly_id = space_id.replace("/", "-").lower()
 
 
 
 
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 = [