Spaces:
Running
Running
Add UTM tracking
Browse files
app.py
CHANGED
|
@@ -15,6 +15,14 @@ MODEL_ENDPOINT = "bria/expand"
|
|
| 15 |
POLL_INTERVAL = 1.5
|
| 16 |
POLL_MAX_SECONDS = 120
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# ============ Aspect Ratios ============
|
| 19 |
ASPECT_RATIOS = ["1:1", "3:2", "2:3", "4:3", "3:4", "16:9", "9:16"]
|
| 20 |
|
|
@@ -425,7 +433,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Image Expand - Bria AI x WaveSpeed") as de
|
|
| 425 |
<div class="hero-badge">BRIA AI x WAVESPEED</div>
|
| 426 |
<h1 class="hero-title">Image Expand</h1>
|
| 427 |
<p class="hero-desc">
|
| 428 |
-
Transform your images with AI-powered expansion. Intelligently extend any image to your desired aspect ratio. Try on <a href="https://wavespeed.ai" target="_blank" style="color: #8b5cf6; text-decoration: none; font-weight: 600;">wavespeed</a>
|
| 429 |
</p>
|
| 430 |
<div class="hero-badges">
|
| 431 |
<span>
|
|
@@ -452,7 +460,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Image Expand - Bria AI x WaveSpeed") as de
|
|
| 452 |
<svg width="20" height="20" fill="#8b5cf6" 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>
|
| 453 |
API Key
|
| 454 |
</span>
|
| 455 |
-
<a href="https://wavespeed.ai/accesskey" target="_blank" class="get-key-btn">Get API Key</a>
|
| 456 |
</div>
|
| 457 |
""")
|
| 458 |
api_key_input = gr.Textbox(
|
|
@@ -506,7 +514,7 @@ with gr.Blocks(css=CUSTOM_CSS, title="Image Expand - Bria AI x WaveSpeed") as de
|
|
| 506 |
<div class="cta-container">
|
| 507 |
<h3 class="cta-title">Want More Features?</h3>
|
| 508 |
<p class="cta-desc">Higher resolutions, batch processing, and 700+ AI models</p>
|
| 509 |
-
<a href="https://wavespeed.ai/models" target="_blank" class="cta-btn">
|
| 510 |
Explore WaveSpeed.ai
|
| 511 |
</a>
|
| 512 |
</div>
|
|
|
|
| 15 |
POLL_INTERVAL = 1.5
|
| 16 |
POLL_MAX_SECONDS = 120
|
| 17 |
|
| 18 |
+
|
| 19 |
+
# ============ UTM Tracking ============
|
| 20 |
+
UTM_CAMPAIGN = "bria_expand"
|
| 21 |
+
|
| 22 |
+
def add_utm(base_url: str, content: str) -> str:
|
| 23 |
+
separator = "&" if "?" in base_url else "?"
|
| 24 |
+
return f"{base_url}{separator}utm_source=huggingface&utm_medium=space&utm_campaign={UTM_CAMPAIGN}&utm_content={content}"
|
| 25 |
+
|
| 26 |
# ============ Aspect Ratios ============
|
| 27 |
ASPECT_RATIOS = ["1:1", "3:2", "2:3", "4:3", "3:4", "16:9", "9:16"]
|
| 28 |
|
|
|
|
| 433 |
<div class="hero-badge">BRIA AI x WAVESPEED</div>
|
| 434 |
<h1 class="hero-title">Image Expand</h1>
|
| 435 |
<p class="hero-desc">
|
| 436 |
+
Transform your images with AI-powered expansion. Intelligently extend any image to your desired aspect ratio. Try on <a href="{add_utm(\'https://wavespeed.ai\', \'hero_link\')}" target="_blank" style="color: #8b5cf6; text-decoration: none; font-weight: 600;">wavespeed</a>
|
| 437 |
</p>
|
| 438 |
<div class="hero-badges">
|
| 439 |
<span>
|
|
|
|
| 460 |
<svg width="20" height="20" fill="#8b5cf6" 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>
|
| 461 |
API Key
|
| 462 |
</span>
|
| 463 |
+
<a href="{add_utm(\'https://wavespeed.ai/accesskey\', \'api_key_button\')}" target="_blank" class="get-key-btn">Get API Key</a>
|
| 464 |
</div>
|
| 465 |
""")
|
| 466 |
api_key_input = gr.Textbox(
|
|
|
|
| 514 |
<div class="cta-container">
|
| 515 |
<h3 class="cta-title">Want More Features?</h3>
|
| 516 |
<p class="cta-desc">Higher resolutions, batch processing, and 700+ AI models</p>
|
| 517 |
+
<a href="{add_utm(\'https://wavespeed.ai/models\', \'cta_button\')}" target="_blank" class="cta-btn">
|
| 518 |
Explore WaveSpeed.ai
|
| 519 |
</a>
|
| 520 |
</div>
|