Phoenixak99 commited on
Commit
f24eb2e
·
verified ·
1 Parent(s): 75710eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -45
app.py CHANGED
@@ -268,50 +268,14 @@ 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
- # Also update the duration slider to show the restriction
272
- if "jwt_token" in st.session_state:
273
- auth_headers = get_auth_headers()
274
- subscription_url = "https://songlabai.com/wp-json/custom-api/v1/subscription"
275
- try:
276
- subscription_response = requests.get(subscription_url, headers=auth_headers)
277
- if subscription_response.status_code == 200:
278
- subscription_data = subscription_response.json()
279
- is_free_tier = subscription_data.get("subscription_tier") == "free"
280
-
281
- if is_free_tier:
282
- duration = st.slider(
283
- "Duration (in seconds):",
284
- min_value=15,
285
- max_value=30, # Restrict to 30 seconds for free tier
286
- value=30,
287
- step=1,
288
- help="Free tier users are limited to 30-second generations. Upgrade to create longer tracks!"
289
- )
290
- else:
291
- duration = st.slider(
292
- "Duration (in seconds):",
293
- min_value=15,
294
- max_value=300,
295
- value=30,
296
- step=1
297
- )
298
- except Exception as e:
299
- st.error(f"Error checking subscription status: {str(e)}")
300
- duration = st.slider(
301
- "Duration (in seconds):",
302
- min_value=15,
303
- max_value=300,
304
- value=30,
305
- step=1
306
- )
307
- else:
308
- duration = st.slider(
309
- "Duration (in seconds):",
310
- min_value=15,
311
- max_value=300,
312
- value=30,
313
- step=1
314
- )
315
 
316
 
317
 
@@ -479,7 +443,7 @@ def generate_audio(genre, energy_level, tempo, description, duration):
479
  # Check for free tier duration restriction
480
  is_free_tier = subscription_data.get("subscription_tier") == "free"
481
  if is_free_tier and duration > 30:
482
- st.warning("⚠️ Free tier users are limited to 30-second generations. Your duration has been automatically adjusted.")
483
  st.info("💡 Upgrade to a premium plan to generate longer tracks!\n\n👉 [Upgrade Now](https://songlabai.com/subscribe/)")
484
  duration = 30 # Force duration to 30 seconds for free tier
485
 
 
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
+ # Always show the full duration slider initially
272
+ duration = st.slider(
273
+ "Duration (in seconds):",
274
+ min_value=15,
275
+ max_value=300,
276
+ value=30,
277
+ step=1
278
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
 
281
 
 
443
  # Check for free tier duration restriction
444
  is_free_tier = subscription_data.get("subscription_tier") == "free"
445
  if is_free_tier and duration > 30:
446
+ st.warning("⚠️ Free tier users are limited to 30-second generations.")
447
  st.info("💡 Upgrade to a premium plan to generate longer tracks!\n\n👉 [Upgrade Now](https://songlabai.com/subscribe/)")
448
  duration = 30 # Force duration to 30 seconds for free tier
449