selfitcamera commited on
Commit
506b22c
Β·
1 Parent(s): 5cbc67b
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -51,6 +51,33 @@ def generate_spongebob_voice_with_realtime_updates(text, word_num, request: gr.R
51
  if not text or len(text.strip()) < 3:
52
  return "Text too short, please enter at least 3 characters", None, "No task information", gr.update(visible=False), ""
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  try:
55
  task_type = "voice"
56
 
@@ -157,6 +184,7 @@ with gr.Blocks(title="Spongebob AI Voice", theme=gr.themes.Soft()) as demo:
157
  text_input = gr.Textbox(
158
  label="πŸ“ Input Text",
159
  lines=4,
 
160
  placeholder="Enter what you want Spongebob to say...",
161
  value="I'm ready! I'm ready! This is a demonstration of the Spongebob AI Voice system with cheerful underwater vibes!"
162
  )
 
51
  if not text or len(text.strip()) < 3:
52
  return "Text too short, please enter at least 3 characters", None, "No task information", gr.update(visible=False), ""
53
 
54
+ if len(text.strip()) >= 1800:
55
+ msg = "⚠️ This space has a maximum limit of 2000 characters. Please visit our official website to generate longer content for free."
56
+ # Create "Go to Official Website" button HTML
57
+ go_to_website_html = f"""
58
+ <div style='display: flex; justify-content: center; gap: 30px; margin: 10px 0 25px 0; padding: 0px;'>
59
+ <a href='https://trumpaivoice.net/spongebob-ai-voice#generator' target='_blank' style='
60
+ display: inline-flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ padding: 16px 32px;
64
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
65
+ color: white;
66
+ text-decoration: none;
67
+ border-radius: 12px;
68
+ font-weight: 600;
69
+ font-size: 16px;
70
+ text-align: center;
71
+ min-width: 160px;
72
+ box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
73
+ transition: all 0.3s ease;
74
+ border: none;
75
+ '>🌐 Go to Official Website for Free</a>
76
+ </div>
77
+ """
78
+ yield msg, None, "", gr.update(value=go_to_website_html, visible=True), ""
79
+ return msg, None, "", gr.update(value=go_to_website_html, visible=True), ""
80
+
81
  try:
82
  task_type = "voice"
83
 
 
184
  text_input = gr.Textbox(
185
  label="πŸ“ Input Text",
186
  lines=4,
187
+ max_length=2000,
188
  placeholder="Enter what you want Spongebob to say...",
189
  value="I'm ready! I'm ready! This is a demonstration of the Spongebob AI Voice system with cheerful underwater vibes!"
190
  )