Nior18867 commited on
Commit
64c2b10
·
verified ·
1 Parent(s): e24b8ac

Add UTM tracking

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -17,6 +17,14 @@ POLL_MAX_SECONDS = 120
17
 
18
 
19
 
 
 
 
 
 
 
 
 
20
  # ============ CSS ============
21
  CUSTOM_CSS = """
22
  /* ===== Base Styles ===== */
@@ -411,7 +419,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Fibo Edit - WaveSpeed") as demo:
411
  <div class="hero-container">
412
  <div class="hero-badge">BRIA x WAVESPEED</div>
413
  <h1 class="hero-title">Fibo Edit</h1>
414
- <p class="hero-desc">AI-powered image editing with Bria Image 3.2. Try on <a href="https://wavespeed.ai" target="_blank" style="color: #8b5cf6; text-decoration: none; font-weight: 600;">wavespeed</a></p>
415
  <div class="hero-badges">
416
  <span>
417
  <svg width="18" height="18" fill="#10b981" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"/></svg>
@@ -439,7 +447,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Fibo Edit - WaveSpeed") as demo:
439
  <svg width="20" height="20" fill="#10b981" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z" clip-rule="evenodd"/></svg>
440
  API Key
441
  </span>
442
- <a href="https://wavespeed.ai/accesskey" target="_blank" class="get-key-btn">Get API Key</a>
443
  </div>
444
  """)
445
  api_key_input = gr.Textbox(
@@ -492,7 +500,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Fibo Edit - WaveSpeed") as demo:
492
  <div class="cta-container">
493
  <h3 class="cta-title">Want More Features?</h3>
494
  <p class="cta-desc">Higher resolutions, batch processing, and 700+ AI models</p>
495
- <a href="https://wavespeed.ai/models" target="_blank" class="cta-btn">
496
  Explore WaveSpeed.ai
497
  </a>
498
  </div>
 
17
 
18
 
19
 
20
+
21
+ # ============ UTM Tracking ============
22
+ UTM_CAMPAIGN = "fibo_edit"
23
+
24
+ def add_utm(base_url: str, content: str) -> str:
25
+ separator = "&" if "?" in base_url else "?"
26
+ return f"{base_url}{separator}utm_source=huggingface&utm_medium=space&utm_campaign={UTM_CAMPAIGN}&utm_content={content}"
27
+
28
  # ============ CSS ============
29
  CUSTOM_CSS = """
30
  /* ===== Base Styles ===== */
 
419
  <div class="hero-container">
420
  <div class="hero-badge">BRIA x WAVESPEED</div>
421
  <h1 class="hero-title">Fibo Edit</h1>
422
+ <p class="hero-desc">AI-powered image editing with Bria Image 3.2. Try on <a href="{add_utm(\'https://wavespeed.ai\', \'hero_link\')}" target="_blank" style="color: #8b5cf6; text-decoration: none; font-weight: 600;">wavespeed</a></p>
423
  <div class="hero-badges">
424
  <span>
425
  <svg width="18" height="18" fill="#10b981" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"/></svg>
 
447
  <svg width="20" height="20" fill="#10b981" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z" clip-rule="evenodd"/></svg>
448
  API Key
449
  </span>
450
+ <a href="{add_utm(\'https://wavespeed.ai/accesskey\', \'api_key_button\')}" target="_blank" class="get-key-btn">Get API Key</a>
451
  </div>
452
  """)
453
  api_key_input = gr.Textbox(
 
500
  <div class="cta-container">
501
  <h3 class="cta-title">Want More Features?</h3>
502
  <p class="cta-desc">Higher resolutions, batch processing, and 700+ AI models</p>
503
+ <a href="{add_utm(\'https://wavespeed.ai/models\', \'cta_button\')}" target="_blank" class="cta-btn">
504
  Explore WaveSpeed.ai
505
  </a>
506
  </div>