Spaces:
Running
Running
Phoenixak99
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -268,15 +268,40 @@ energy_level = st.radio("Energy Level:", energy_levels, horizontal=True)
|
|
268 |
description = st.text_input("Description:", "")
|
269 |
tempo = st.slider("Tempo (in bpm):", min_value=40, max_value=100, value=60, step=5)
|
270 |
|
271 |
-
#
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
)
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
|
281 |
|
282 |
def convert_audio_segment_to_float_array(audio_pydub):
|
@@ -351,28 +376,32 @@ def wait_for_server_warmup(status_placeholder, progress_placeholder, subscriptio
|
|
351 |
### π **Subscription Tiers**
|
352 |
|
353 |
**Free User**
|
354 |
-
- π΅ **Generations:** 3 music generations
|
355 |
-
- π₯ **Downloads:** No downloads allowed
|
356 |
-
-
|
357 |
-
|
358 |
-
**
|
359 |
-
|
360 |
-
|
361 |
-
-
|
362 |
-
|
363 |
-
**
|
364 |
-
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
**
|
369 |
-
-
|
370 |
-
-
|
371 |
-
|
|
|
|
|
|
|
|
|
|
|
372 |
|
373 |
### π **Why Subscribe?**
|
374 |
-
|
375 |
-
Enjoy faster access and a smoother experience with a premium subscription!
|
376 |
"""
|
377 |
|
378 |
start_time = time.time()
|
@@ -441,19 +470,17 @@ def generate_audio(genre, energy_level, tempo, description, duration):
|
|
441 |
subscription_data = subscription_response.json()
|
442 |
|
443 |
# Check for free tier duration restriction
|
444 |
-
is_free_tier =
|
445 |
-
if is_free_tier
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
)
|
456 |
-
return
|
457 |
|
458 |
# Check if server is cold
|
459 |
if not check_server_status():
|
|
|
268 |
description = st.text_input("Description:", "")
|
269 |
tempo = st.slider("Tempo (in bpm):", min_value=40, max_value=100, value=60, step=5)
|
270 |
|
271 |
+
# First, check subscription status if user is logged in
|
272 |
+
if st.session_state.get("jwt_token"):
|
273 |
+
auth_headers = get_auth_headers()
|
274 |
+
subscription_url = "https://songlabai.com/wp-json/custom-api/v1/subscription"
|
275 |
+
subscription_response = requests.get(subscription_url, headers=auth_headers)
|
276 |
+
|
277 |
+
if subscription_response.status_code == 200:
|
278 |
+
subscription_data = subscription_response.json()
|
279 |
+
subscription_plan_id = subscription_data.get("subscription_plan_id")
|
280 |
+
# Free tier has plan ID 576 or null
|
281 |
+
is_free_tier = not subscription_plan_id or subscription_plan_id == 576
|
282 |
+
else:
|
283 |
+
is_free_tier = True # Default to free tier if unable to verify
|
284 |
+
else:
|
285 |
+
is_free_tier = True # Default to free tier if not logged in
|
286 |
+
|
287 |
+
# Show appropriate duration slider based on subscription tier
|
288 |
+
if is_free_tier:
|
289 |
+
duration = st.slider(
|
290 |
+
"Duration (in seconds):",
|
291 |
+
min_value=15,
|
292 |
+
max_value=30, # Restricted to 30 seconds for free tier
|
293 |
+
value=30,
|
294 |
+
step=1,
|
295 |
+
help="Free tier users are limited to 30-second generations. Upgrade to create longer tracks!"
|
296 |
+
)
|
297 |
+
else:
|
298 |
+
duration = st.slider(
|
299 |
+
"Duration (in seconds):",
|
300 |
+
min_value=15,
|
301 |
+
max_value=300,
|
302 |
+
value=30,
|
303 |
+
step=1
|
304 |
+
)
|
305 |
|
306 |
|
307 |
def convert_audio_segment_to_float_array(audio_pydub):
|
|
|
376 |
### π **Subscription Tiers**
|
377 |
|
378 |
**Free User**
|
379 |
+
- π΅ **Generations:** 3 music generations
|
380 |
+
- π₯ **Downloads:** No downloads allowed
|
381 |
+
- πΌ **Submit your track from dashboard**
|
382 |
+
- π° **Receive 50% commission**
|
383 |
+
- π΅ **Tracks sale for $1 on website**
|
384 |
+
|
385 |
+
**Tier 2 - $24.99/month**
|
386 |
+
- π΅ **Generations:** Up to 3 music generations per day
|
387 |
+
- π₯ **Downloads:** 1 download per month
|
388 |
+
- π **Private Tracks:** Create unpublished, private tracks
|
389 |
+
- π **Dashboard:** Access your profile and save up to 2 tracks
|
390 |
+
|
391 |
+
**Tier 3 - $99.99/month**
|
392 |
+
- π΅ **Generations:** Up to 5 music generations per day
|
393 |
+
- π₯ **Downloads:** 5 downloads per month
|
394 |
+
- π **Dashboard:** Full profile access for managing and saving your tracks
|
395 |
+
- πΎ **Storage:** Save up to 10 tracks
|
396 |
+
|
397 |
+
**Tier 4 - $269.97/month**
|
398 |
+
- π΅ **Generations:** Up to 20 music generations per day
|
399 |
+
- π₯ **Downloads:** 15 downloads per month
|
400 |
+
- π’ **Commercial Use:** Includes rights for commercial purposes
|
401 |
+
- π **Dashboard:** Advanced profile management for commercial accounts
|
402 |
|
403 |
### π **Why Subscribe?**
|
404 |
+
Upgrade now to unlock more features and enhance your music creation experience!
|
|
|
405 |
"""
|
406 |
|
407 |
start_time = time.time()
|
|
|
470 |
subscription_data = subscription_response.json()
|
471 |
|
472 |
# Check for free tier duration restriction
|
473 |
+
is_free_tier = not subscription_plan_id or subscription_plan_id == 576
|
474 |
+
if is_free_tier:
|
475 |
+
if duration > 30:
|
476 |
+
st.warning("β οΈ Free tier users are limited to 30-second generations.")
|
477 |
+
st.info("π‘ Upgrade to a premium plan to generate longer tracks!\n\n" +
|
478 |
+
"**Available Plans:**\n" +
|
479 |
+
"- **$24.99/month:** Up to 3 generations per day, 1 download per month\n" +
|
480 |
+
"- **$99.99/month:** Up to 5 generations per day, 5 downloads per month\n" +
|
481 |
+
"- **$269.97/month:** Up to 20 generations per day, 15 downloads per month\n\n" +
|
482 |
+
"π [Upgrade Now](https://songlabai.com/subscribe/)")
|
483 |
+
duration = 30 # Force duration to 30 seconds for free tier
|
|
|
|
|
484 |
|
485 |
# Check if server is cold
|
486 |
if not check_server_status():
|