selfitcamera commited on
Commit ·
a9f20a6
1
Parent(s): ef0b941
init
Browse files- README.md +1 -1
- app.py +480 -0
- push.sh +13 -0
- requirements.txt +4 -0
- util.py +118 -0
README.md
CHANGED
|
@@ -8,7 +8,7 @@ sdk_version: 5.45.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
-
short_description: Charlie Kirk AI Voice and Video Generator
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
short_description: Charlie Kirk AI Voice and Video Generator for Free
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import time
|
| 3 |
+
import uuid
|
| 4 |
+
from util import (
|
| 5 |
+
create_task_v3,
|
| 6 |
+
get_task_result,
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
IP_Dict = {}
|
| 11 |
+
|
| 12 |
+
def generate_charlie_kirk_voice_with_realtime_updates(text, word_num, request: gr.Request):
|
| 13 |
+
"""
|
| 14 |
+
Charlie Kirk AI voice generation function with real-time status updates
|
| 15 |
+
"""
|
| 16 |
+
client_ip = request.client.host
|
| 17 |
+
x_forwarded_for = dict(request.headers).get('x-forwarded-for')
|
| 18 |
+
if x_forwarded_for:
|
| 19 |
+
client_ip = x_forwarded_for
|
| 20 |
+
if client_ip not in IP_Dict:
|
| 21 |
+
IP_Dict[client_ip] = 0
|
| 22 |
+
IP_Dict[client_ip] += 1
|
| 23 |
+
print(f"client_ip: {client_ip}, count: {IP_Dict[client_ip]}")
|
| 24 |
+
if IP_Dict[client_ip] >= 6:
|
| 25 |
+
msg = "You have reached the maximum number of requests"
|
| 26 |
+
# Create "Get More Tries" button HTML
|
| 27 |
+
get_more_tries_html = f"""
|
| 28 |
+
<div style='display: flex; justify-content: center; gap: 30px; margin: 10px 0 25px 0; padding: 0px;'>
|
| 29 |
+
<a href='https://trumpaivoice.net/charlie-kirk-ai-voice#generator' target='_blank' style='
|
| 30 |
+
display: inline-flex;
|
| 31 |
+
align-items: center;
|
| 32 |
+
justify-content: center;
|
| 33 |
+
padding: 16px 32px;
|
| 34 |
+
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
|
| 35 |
+
color: white;
|
| 36 |
+
text-decoration: none;
|
| 37 |
+
border-radius: 12px;
|
| 38 |
+
font-weight: 600;
|
| 39 |
+
font-size: 16px;
|
| 40 |
+
text-align: center;
|
| 41 |
+
min-width: 160px;
|
| 42 |
+
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
|
| 43 |
+
transition: all 0.3s ease;
|
| 44 |
+
border: none;
|
| 45 |
+
'>🚀 Get More Tries for Free</a>
|
| 46 |
+
</div>
|
| 47 |
+
"""
|
| 48 |
+
yield msg, None, gr.update(value=get_more_tries_html, visible=True), ""
|
| 49 |
+
return msg, None, gr.update(value=get_more_tries_html, visible=True), ""
|
| 50 |
+
|
| 51 |
+
if not text or len(text.strip()) < 3:
|
| 52 |
+
return "Text too short, please enter at least 3 characters", None, gr.update(visible=False), ""
|
| 53 |
+
|
| 54 |
+
try:
|
| 55 |
+
task_type = "voice"
|
| 56 |
+
|
| 57 |
+
# Create task
|
| 58 |
+
task_result = create_task_v3(task_type, text.strip(), word_num, is_rewrite=False)
|
| 59 |
+
if not task_result:
|
| 60 |
+
return "Failed to create task", None, gr.update(visible=False), ""
|
| 61 |
+
else:
|
| 62 |
+
yield "Task created successfully", None, gr.update(visible=False), ""
|
| 63 |
+
|
| 64 |
+
max_polls = 300
|
| 65 |
+
poll_interval = 1
|
| 66 |
+
task_url = f"https://trumpaivoice.net/task/{task_result['uuid']}"
|
| 67 |
+
|
| 68 |
+
for i in range(max_polls):
|
| 69 |
+
time.sleep(poll_interval)
|
| 70 |
+
task = get_task_result(task_result['uuid'])
|
| 71 |
+
# print(task, i, "get_task_result")
|
| 72 |
+
if task.get('data', {}):
|
| 73 |
+
status = task.get('data').get('status', '')
|
| 74 |
+
text_final = task.get('data').get('text_final', '')
|
| 75 |
+
if status in ['completed',]:
|
| 76 |
+
voice_url = task.get('data').get('voice_url', '')
|
| 77 |
+
print(voice_url, "===>voice_url")
|
| 78 |
+
|
| 79 |
+
# 下载音频文件到本地以避免SSRF保护问题
|
| 80 |
+
local_audio_path = voice_url
|
| 81 |
+
|
| 82 |
+
# Create action buttons HTML
|
| 83 |
+
action_buttons_html = f"""
|
| 84 |
+
<div style='display: flex; justify-content: center; gap: 30px; margin: 25px 0; padding: 20px;'>
|
| 85 |
+
<a href='https://trumpaivoice.net/charlie-kirk-ai-voice#generator' target='_blank' style='
|
| 86 |
+
display: inline-flex;
|
| 87 |
+
align-items: center;
|
| 88 |
+
justify-content: center;
|
| 89 |
+
padding: 16px 32px;
|
| 90 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 91 |
+
color: white;
|
| 92 |
+
text-decoration: none;
|
| 93 |
+
border-radius: 12px;
|
| 94 |
+
font-weight: 600;
|
| 95 |
+
font-size: 16px;
|
| 96 |
+
text-align: center;
|
| 97 |
+
min-width: 160px;
|
| 98 |
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
| 99 |
+
transition: all 0.3s ease;
|
| 100 |
+
border: none;
|
| 101 |
+
'>🎬 Generate 4K Video</a>
|
| 102 |
+
<a href='{task_url}' target='_blank' style='
|
| 103 |
+
display: inline-flex;
|
| 104 |
+
align-items: center;
|
| 105 |
+
justify-content: center;
|
| 106 |
+
padding: 16px 32px;
|
| 107 |
+
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
|
| 108 |
+
color: white;
|
| 109 |
+
text-decoration: none;
|
| 110 |
+
border-radius: 12px;
|
| 111 |
+
font-weight: 600;
|
| 112 |
+
font-size: 16px;
|
| 113 |
+
text-align: center;
|
| 114 |
+
min-width: 160px;
|
| 115 |
+
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
|
| 116 |
+
transition: all 0.3s ease;
|
| 117 |
+
border: none;
|
| 118 |
+
'>👀 Check Generate Details</a>
|
| 119 |
+
</div>
|
| 120 |
+
"""
|
| 121 |
+
yield f"✅ success!!!", local_audio_path, gr.update(value=action_buttons_html, visible=True), task_url
|
| 122 |
+
return "✅ Generation successful!", local_audio_path, gr.update(value=action_buttons_html, visible=True), task_url
|
| 123 |
+
elif status in ['failed', 'voice_error', 'no_credits']:
|
| 124 |
+
yield "❌ Generation failed!", None, gr.update(visible=False), ""
|
| 125 |
+
return "❌ Generation failed!", None, gr.update(visible=False), ""
|
| 126 |
+
else:
|
| 127 |
+
yield f"query {i} times, on processing, go to task page {task_url} to check status", None, gr.update(visible=False), task_url
|
| 128 |
+
return "❌ Generation failed!", None, gr.update(visible=False), ""
|
| 129 |
+
except Exception as e:
|
| 130 |
+
error_msg = f"Generation failed: {str(e)}"
|
| 131 |
+
yield error_msg, None, gr.update(visible=False), ""
|
| 132 |
+
return error_msg, None, gr.update(visible=False), ""
|
| 133 |
+
|
| 134 |
+
# Create Gradio Interface
|
| 135 |
+
with gr.Blocks(title="Charlie Kirk AI Voice", theme=gr.themes.Soft()) as demo:
|
| 136 |
+
|
| 137 |
+
# Main title - at the top
|
| 138 |
+
gr.HTML("""
|
| 139 |
+
<div style="text-align: center; margin: 5px auto 0px auto; max-width: 800px;">
|
| 140 |
+
<h1 style="color: #2c3e50; margin: 0; font-size: 3.5em; font-weight: 800; letter-spacing: 3px; text-shadow: 2px 2px 4px rgba(0,0,0,0.1);">
|
| 141 |
+
🎤 Charlie Kirk AI Voice
|
| 142 |
+
</h1>
|
| 143 |
+
</div>
|
| 144 |
+
""", padding=False)
|
| 145 |
+
|
| 146 |
+
# # Showcase link banner - second
|
| 147 |
+
# gr.HTML("""
|
| 148 |
+
# <div style="text-align: center; margin: 0px auto 40px auto; max-width: 600px;">
|
| 149 |
+
# <div style="background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%); padding: 15px 5px; border-radius: 15px; box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);">
|
| 150 |
+
# <h3 style="color: white; margin: 0; font-size: 18px;">
|
| 151 |
+
# 🎬 <a href="https://trumpaivoice.net/showcase" target="_blank" style="color: white; text-decoration: none; font-weight: bold;">Check out Trump AI videos created by others →</a>
|
| 152 |
+
# </h3>
|
| 153 |
+
# </div>
|
| 154 |
+
# </div>
|
| 155 |
+
# """, padding=False)
|
| 156 |
+
|
| 157 |
+
# Powered by link - small text
|
| 158 |
+
gr.HTML("""
|
| 159 |
+
<div style="text-align: center; margin: 0px auto -5px auto;">
|
| 160 |
+
<p style="margin: 0; font-size: 16px; color: #999; font-weight: 400;">
|
| 161 |
+
powered by <a href="https://trumpaivoice.net/" target="_blank" style="color: #667eea; text-decoration: none;">trumpaivoice.net</a>
|
| 162 |
+
</p>
|
| 163 |
+
</div>
|
| 164 |
+
""", padding=False)
|
| 165 |
+
|
| 166 |
+
# Simple description text - third
|
| 167 |
+
# gr.HTML("""
|
| 168 |
+
# <div style="text-align: center; margin: 15px auto 30px auto; max-width: 500px;">
|
| 169 |
+
# <p style="color: #666; margin: 0; font-size: 1em; font-weight: 500; line-height: 1.4;">
|
| 170 |
+
# 🔥 Try the most advanced Trump AI Voice and Video generator for FREE at
|
| 171 |
+
# <a href="https://trumpaivoice.net/" target="_blank" style="color: #667eea; text-decoration: none; font-weight: bold;">donaldtrumpaivoice.com</a>!
|
| 172 |
+
# </p>
|
| 173 |
+
# </div>
|
| 174 |
+
# """)
|
| 175 |
+
|
| 176 |
+
with gr.Row():
|
| 177 |
+
with gr.Column(scale=2):
|
| 178 |
+
text_input = gr.Textbox(
|
| 179 |
+
label="📝 Input Text",
|
| 180 |
+
lines=4,
|
| 181 |
+
placeholder="Enter what you want Charlie Kirk to say...",
|
| 182 |
+
value="Hello everyone, this is a demonstration of the Charlie Kirk AI Voice system with real-time status monitoring."
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
with gr.Column(scale=1):
|
| 186 |
+
word_num_slider = gr.Slider(
|
| 187 |
+
20, 60, value=60, step=1,
|
| 188 |
+
label="⏱️ Duration Limit"
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
submit_btn = gr.Button(
|
| 192 |
+
"🚀 Generate Charlie Kirk AI Voice",
|
| 193 |
+
variant="primary",
|
| 194 |
+
size="lg"
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
with gr.Row():
|
| 198 |
+
status_output = gr.Textbox(
|
| 199 |
+
label="📊 Status",
|
| 200 |
+
interactive=False,
|
| 201 |
+
placeholder="Waiting for generation..."
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
# Action buttons that will show after task completion
|
| 205 |
+
with gr.Row():
|
| 206 |
+
action_links = gr.HTML(visible=False)
|
| 207 |
+
|
| 208 |
+
with gr.Row():
|
| 209 |
+
audio_output = gr.Audio(
|
| 210 |
+
label="🎵 Charlie Kirk AI Voice",
|
| 211 |
+
interactive=False
|
| 212 |
+
)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
# Video Showcase Section
|
| 216 |
+
gr.HTML("""
|
| 217 |
+
<div style="width: 100%; margin: 40px 0; padding: 0 20px;">
|
| 218 |
+
<div style="text-align: center; background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 50%, #fce4ec 100%); padding: 30px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); margin-bottom: 30px;">
|
| 219 |
+
<h2 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 2.2em; font-weight: 700;">
|
| 220 |
+
🎬 Video Showcase
|
| 221 |
+
</h2>
|
| 222 |
+
<p style="color: #34495e; font-size: 1.2em; line-height: 1.6; margin: 0 0 25px 0;">
|
| 223 |
+
Watch amazing AI-generated Charlie Kirk videos with realistic animations and perfect lip-sync!
|
| 224 |
+
</p>
|
| 225 |
+
|
| 226 |
+
<!-- Video Gallery -->
|
| 227 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 30px 0;">
|
| 228 |
+
|
| 229 |
+
<div style="background: rgba(255,255,255,0.8); padding: 20px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);">
|
| 230 |
+
<h4 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 1.1em;"> TV Interview</h4>
|
| 231 |
+
<video id="video-garden" style="width: 100%; height: 180px; border-radius: 10px; object-fit: cover;" controls preload="metadata">
|
| 232 |
+
<source src="https://www.trumpaivoice.net/SelfitAssert/Heygem/CharlieKirk/showcase/62_1757582179_O35S1LzJ-r.mp4" type="video/mp4">
|
| 233 |
+
Your browser does not support the video tag.
|
| 234 |
+
</video>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
<div style="background: rgba(255,255,255,0.8); padding: 20px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);">
|
| 238 |
+
<h4 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 1.1em;">AI Song</h4>
|
| 239 |
+
<video id="video-office" style="width: 100%; height: 180px; border-radius: 10px; object-fit: cover;" controls preload="metadata">
|
| 240 |
+
<source src="https://www.trumpaivoice.net/SelfitAssert/Heygem/CharlieKirk/showcase/merged_mv01.mp4" type="video/mp4">
|
| 241 |
+
Your browser does not support the video tag.
|
| 242 |
+
</video>
|
| 243 |
+
</div>
|
| 244 |
+
|
| 245 |
+
<div style="background: rgba(255,255,255,0.8); padding: 20px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);">
|
| 246 |
+
<h4 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 1.1em;"> Charlie Show</h4>
|
| 247 |
+
<video id="video-flag" style="width: 100%; height: 180px; border-radius: 10px; object-fit: cover;" controls preload="metadata">
|
| 248 |
+
<source src="https://www.trumpaivoice.net/SelfitAssert/Heygem/CharlieKirk/showcase/62_1757582322_XBI1s860-r.mp4" type="video/mp4">
|
| 249 |
+
Your browser does not support the video tag.
|
| 250 |
+
</video>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
</div>
|
| 254 |
+
|
| 255 |
+
<!-- Action Buttons -->
|
| 256 |
+
<div style="display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin: 25px 0 0 0;">
|
| 257 |
+
<a href="https://trumpaivoice.net/charlie-kirk-ai-voice#generator" target="_blank" style="
|
| 258 |
+
display: inline-flex;
|
| 259 |
+
align-items: center;
|
| 260 |
+
justify-content: center;
|
| 261 |
+
padding: 18px 35px;
|
| 262 |
+
background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
|
| 263 |
+
color: white;
|
| 264 |
+
text-decoration: none;
|
| 265 |
+
border-radius: 15px;
|
| 266 |
+
font-weight: 700;
|
| 267 |
+
font-size: 16px;
|
| 268 |
+
text-align: center;
|
| 269 |
+
min-width: 220px;
|
| 270 |
+
box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
|
| 271 |
+
transition: all 0.3s ease;
|
| 272 |
+
border: none;
|
| 273 |
+
transform: scale(1);
|
| 274 |
+
" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
|
| 275 |
+
🎬 Generate 4K Charlie Kirk Video
|
| 276 |
+
</a>
|
| 277 |
+
|
| 278 |
+
<a href="https://trumpaivoice.net/charlie-kirk-ai-song#generator" target="_blank" style="
|
| 279 |
+
display: inline-flex;
|
| 280 |
+
align-items: center;
|
| 281 |
+
justify-content: center;
|
| 282 |
+
padding: 18px 35px;
|
| 283 |
+
background: linear-gradient(135deg, #9b59b6 0%, #e74c3c 100%);
|
| 284 |
+
color: white;
|
| 285 |
+
text-decoration: none;
|
| 286 |
+
border-radius: 15px;
|
| 287 |
+
font-weight: 700;
|
| 288 |
+
font-size: 16px;
|
| 289 |
+
text-align: center;
|
| 290 |
+
min-width: 220px;
|
| 291 |
+
box-shadow: 0 8px 25px rgba(155, 89, 182, 0.4);
|
| 292 |
+
transition: all 0.3s ease;
|
| 293 |
+
border: none;
|
| 294 |
+
transform: scale(1);
|
| 295 |
+
" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
|
| 296 |
+
🎵 Create Charlie Kirk AI Song
|
| 297 |
+
</a>
|
| 298 |
+
</div>
|
| 299 |
+
|
| 300 |
+
<p style="color: #555; font-size: 1em; margin: 15px 0 0 0;">
|
| 301 |
+
Create high-quality Charlie Kirk AI videos and original songs with custom text and scenarios!
|
| 302 |
+
</p>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
|
| 306 |
+
<script>
|
| 307 |
+
// Ensure only one video plays at a time
|
| 308 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 309 |
+
const videos = ['video-garden', 'video-office', 'video-flag'];
|
| 310 |
+
|
| 311 |
+
videos.forEach(function(videoId) {
|
| 312 |
+
const video = document.getElementById(videoId);
|
| 313 |
+
if (video) {
|
| 314 |
+
video.addEventListener('play', function() {
|
| 315 |
+
// Pause all other videos when this one starts playing
|
| 316 |
+
videos.forEach(function(otherId) {
|
| 317 |
+
if (otherId !== videoId) {
|
| 318 |
+
const otherVideo = document.getElementById(otherId);
|
| 319 |
+
if (otherVideo && !otherVideo.paused) {
|
| 320 |
+
otherVideo.pause();
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
});
|
| 324 |
+
});
|
| 325 |
+
}
|
| 326 |
+
});
|
| 327 |
+
});
|
| 328 |
+
</script>
|
| 329 |
+
""", padding=False)
|
| 330 |
+
|
| 331 |
+
# Comprehensive introduction section
|
| 332 |
+
gr.HTML("""
|
| 333 |
+
<div style="width: 100%; margin: 30px 0; padding: 0 20px;">
|
| 334 |
+
|
| 335 |
+
<!-- Hero Description -->
|
| 336 |
+
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); padding: 30px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 337 |
+
<h2 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 1.8em; font-weight: 700;">
|
| 338 |
+
🇺🇸 Experience the Power of AI-Generated Charlie Kirk Voice
|
| 339 |
+
</h2>
|
| 340 |
+
<p style="color: #555; font-size: 1.1em; line-height: 1.6; margin: 0 0 20px 0; width: 100%; padding: 0 20px;">
|
| 341 |
+
Transform any text into authentic Charlie Kirk speech with our cutting-edge AI voice synthesis technology.
|
| 342 |
+
Whether you're creating content for entertainment, education, or social media, our advanced neural network
|
| 343 |
+
captures Charlie Kirk's distinctive speaking style, intonation, and rhetorical patterns with remarkable accuracy.
|
| 344 |
+
</p>
|
| 345 |
+
</div>
|
| 346 |
+
|
| 347 |
+
<!-- Features Grid -->
|
| 348 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 40px 0;">
|
| 349 |
+
|
| 350 |
+
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #e74c3c;">
|
| 351 |
+
<h3 style="color: #e74c3c; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 352 |
+
🎯 Ultra-Realistic Voice
|
| 353 |
+
</h3>
|
| 354 |
+
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 355 |
+
Our AI model is trained on thousands of hours of Charlie Kirk speeches, capturing his unique vocal characteristics,
|
| 356 |
+
pronunciation patterns, and speaking rhythm to deliver incredibly lifelike results.
|
| 357 |
+
</p>
|
| 358 |
+
</div>
|
| 359 |
+
|
| 360 |
+
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #3498db;">
|
| 361 |
+
<h3 style="color: #3498db; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 362 |
+
⚡ Lightning Fast Generation
|
| 363 |
+
</h3>
|
| 364 |
+
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 365 |
+
Generate high-quality Charlie Kirk AI voice clips in seconds, not minutes. Our optimized infrastructure
|
| 366 |
+
ensures rapid processing while maintaining exceptional audio quality.
|
| 367 |
+
</p>
|
| 368 |
+
</div>
|
| 369 |
+
|
| 370 |
+
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #27ae60;">
|
| 371 |
+
<h3 style="color: #27ae60; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 372 |
+
🎨 Creative Content Creation
|
| 373 |
+
</h3>
|
| 374 |
+
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 375 |
+
Perfect for memes, podcasts, educational content, entertainment videos, or any creative project
|
| 376 |
+
that needs an authentic Charlie Kirk voice performance.
|
| 377 |
+
</p>
|
| 378 |
+
</div>
|
| 379 |
+
|
| 380 |
+
</div>
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
<!-- Celebrity Voices Section -->
|
| 384 |
+
<div style="background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%); color: white; padding: 40px; border-radius: 20px; margin: 40px 0; text-align: center;">
|
| 385 |
+
<h2 style="margin: 0 0 20px 0; font-size: 1.8em; font-weight: 700;">
|
| 386 |
+
🎭 Try More Celebrity AI Voices
|
| 387 |
+
</h2>
|
| 388 |
+
<p style="margin: 0 0 25px 0; font-size: 1.1em; opacity: 0.95; line-height: 1.5;">
|
| 389 |
+
Explore our premium collection of celebrity AI voices! Our high-quality service delivers
|
| 390 |
+
lightning-fast results with exceptional audio quality. Experience the best AI voice generation
|
| 391 |
+
with our reliable and responsive platform.
|
| 392 |
+
</p>
|
| 393 |
+
<div style="display: flex; justify-content: center; gap: 20px; flex-wrap: wrap;">
|
| 394 |
+
<a href="https://trumpaivoice.net/explore" target="_blank" style="
|
| 395 |
+
display: inline-flex;
|
| 396 |
+
align-items: center;
|
| 397 |
+
justify-content: center;
|
| 398 |
+
padding: 18px 35px;
|
| 399 |
+
background: rgba(255,255,255,0.9);
|
| 400 |
+
color: #333;
|
| 401 |
+
text-decoration: none;
|
| 402 |
+
border-radius: 15px;
|
| 403 |
+
font-weight: 700;
|
| 404 |
+
font-size: 16px;
|
| 405 |
+
text-align: center;
|
| 406 |
+
min-width: 200px;
|
| 407 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
|
| 408 |
+
transition: all 0.3s ease;
|
| 409 |
+
border: none;
|
| 410 |
+
">🌟 Explore Celebrity Voices</a>
|
| 411 |
+
<a href="https://trumpaivoice.net/showcase" target="_blank" style="
|
| 412 |
+
display: inline-flex;
|
| 413 |
+
align-items: center;
|
| 414 |
+
justify-content: center;
|
| 415 |
+
padding: 18px 35px;
|
| 416 |
+
background: rgba(255,255,255,0.2);
|
| 417 |
+
color: white;
|
| 418 |
+
text-decoration: none;
|
| 419 |
+
border-radius: 15px;
|
| 420 |
+
font-weight: 700;
|
| 421 |
+
font-size: 16px;
|
| 422 |
+
text-align: center;
|
| 423 |
+
min-width: 200px;
|
| 424 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.2);
|
| 425 |
+
transition: all 0.3s ease;
|
| 426 |
+
border: 2px solid rgba(255,255,255,0.3);
|
| 427 |
+
">🎭 View Showcase</a>
|
| 428 |
+
</div>
|
| 429 |
+
</div>
|
| 430 |
+
|
| 431 |
+
<!-- Tips Section -->
|
| 432 |
+
<div style="background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%); padding: 25px; border-radius: 15px; margin: 40px 0;">
|
| 433 |
+
<h3 style="color: #8b5cf6; text-align: center; margin: 0 0 20px 0; font-size: 1.4em; font-weight: 700;">
|
| 434 |
+
💡 Pro Tips for Best Results
|
| 435 |
+
</h3>
|
| 436 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px;">
|
| 437 |
+
|
| 438 |
+
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 439 |
+
<strong style="color: #8b5cf6;">📖 Clear Text:</strong>
|
| 440 |
+
<span style="color: #555;"> Use proper punctuation and avoid special characters for optimal results.</span>
|
| 441 |
+
</div>
|
| 442 |
+
|
| 443 |
+
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 444 |
+
<strong style="color: #8b5cf6;">⏱️ Length Matters:</strong>
|
| 445 |
+
<span style="color: #555;"> Shorter texts (20-60 words) typically produce the most natural-sounding results.</span>
|
| 446 |
+
</div>
|
| 447 |
+
|
| 448 |
+
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 449 |
+
<strong style="color: #8b5cf6;">🎯 Charlie Kirk Style:</strong>
|
| 450 |
+
<span style="color: #555;"> Text written in Charlie Kirk's speaking style will sound more authentic and natural.</span>
|
| 451 |
+
</div>
|
| 452 |
+
|
| 453 |
+
</div>
|
| 454 |
+
</div>
|
| 455 |
+
|
| 456 |
+
</div>
|
| 457 |
+
""", padding=False)
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
# Powered by link - small text
|
| 461 |
+
gr.HTML("""
|
| 462 |
+
<div style="text-align: center; margin: 0px auto -5px auto;">
|
| 463 |
+
<p style="margin: 0; font-size: 16px; color: #999; font-weight: 400;">
|
| 464 |
+
Click <a href="https://trumpaivoice.net/showcase" target="_blank" style="color: #667eea; text-decoration: none;"> charlie kirk ai voices showcase </a> to see more videos
|
| 465 |
+
</p>
|
| 466 |
+
</div>
|
| 467 |
+
""", padding=False)
|
| 468 |
+
|
| 469 |
+
# Hidden state to store task_url
|
| 470 |
+
task_url_state = gr.State("")
|
| 471 |
+
|
| 472 |
+
# Bind event
|
| 473 |
+
submit_btn.click(
|
| 474 |
+
generate_charlie_kirk_voice_with_realtime_updates,
|
| 475 |
+
inputs=[text_input, word_num_slider],
|
| 476 |
+
outputs=[status_output, audio_output, action_links, task_url_state]
|
| 477 |
+
)
|
| 478 |
+
|
| 479 |
+
if __name__ == "__main__":
|
| 480 |
+
demo.launch()
|
push.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# 设置仓库级别用户名
|
| 3 |
+
git config user.name "selfitcamera"
|
| 4 |
+
git config user.email "ethan.blake@heybeauty.ai"
|
| 5 |
+
|
| 6 |
+
# 验证
|
| 7 |
+
git config user.name
|
| 8 |
+
git config user.email
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
git add .
|
| 12 |
+
git commit -m "init"
|
| 13 |
+
git push
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio>=4.0.0
|
| 2 |
+
requests>=2.31.0
|
| 3 |
+
supabase>=2.0.0
|
| 4 |
+
python-dotenv>=1.0.0
|
util.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import time
|
| 3 |
+
import uuid
|
| 4 |
+
import os
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
from supabase import create_client, Client
|
| 7 |
+
|
| 8 |
+
try:
|
| 9 |
+
OneKey = os.environ['OneKey'].strip()
|
| 10 |
+
|
| 11 |
+
OneKey = OneKey.split("#")
|
| 12 |
+
TrumpAiUrl = OneKey[0]
|
| 13 |
+
ApiKey = OneKey[1]
|
| 14 |
+
SUPABASE_URL = OneKey[2]
|
| 15 |
+
UserUuid = OneKey[3]
|
| 16 |
+
BackendUrl = OneKey[4]
|
| 17 |
+
BackendApiKey = OneKey[5]
|
| 18 |
+
SUPABASE_KEY = OneKey[6]
|
| 19 |
+
# GRADIO_ALLOWED_HOSTNAMES = OneKey[7]
|
| 20 |
+
# os.environ["GRADIO_ALLOWED_HOSTNAMES"] = GRADIO_ALLOWED_HOSTNAMES
|
| 21 |
+
except Exception as e:
|
| 22 |
+
print(f"OneKey: {e}")
|
| 23 |
+
# exit(1)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# 创建Supabase客户端
|
| 27 |
+
supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 28 |
+
|
| 29 |
+
# 任务状态枚举
|
| 30 |
+
class TaskStatus:
|
| 31 |
+
Created = "created"
|
| 32 |
+
Processing = "processing"
|
| 33 |
+
TextRewrited = "text_rewrited"
|
| 34 |
+
TextFormated = "text_formated"
|
| 35 |
+
VoiceCompleted = "voice_completed"
|
| 36 |
+
VoiceError = "voice_error"
|
| 37 |
+
VideoCompleted = "video_completed"
|
| 38 |
+
VideoPublished = "video_published"
|
| 39 |
+
VideoError = "video_error"
|
| 40 |
+
Completed = "completed"
|
| 41 |
+
Failed = "failed"
|
| 42 |
+
Cancelled = "cancelled"
|
| 43 |
+
NoCredits = "no_credits"
|
| 44 |
+
|
| 45 |
+
# 视频模板枚举
|
| 46 |
+
class VideoTemplate:
|
| 47 |
+
Outdoor = "outdoor"
|
| 48 |
+
UsFlag = "us-flag"
|
| 49 |
+
WhiteHouse = "white-house"
|
| 50 |
+
|
| 51 |
+
def create_task_v3(task_type, text, word_num, is_rewrite):
|
| 52 |
+
import json
|
| 53 |
+
is_rewrite = False
|
| 54 |
+
url = f"{BackendUrl}/trump_process_ctx_api_v2"
|
| 55 |
+
headers = {
|
| 56 |
+
"Content-Type": "application/json"
|
| 57 |
+
}
|
| 58 |
+
print(url)
|
| 59 |
+
data = {
|
| 60 |
+
"video_template": "",
|
| 61 |
+
"speaker_template": "https://www.trumpaivoice.net/SelfitAssert/Heygem/CharlieKirk/charlie_audio_template01.MP3",
|
| 62 |
+
"text": text,
|
| 63 |
+
"word_num": word_num,
|
| 64 |
+
"is_rewrite": False,
|
| 65 |
+
"watermark": True,
|
| 66 |
+
"type": "voice",
|
| 67 |
+
"cost_credits": 2,
|
| 68 |
+
"user_uuid": UserUuid,
|
| 69 |
+
"secret_key": "219ngu"
|
| 70 |
+
}
|
| 71 |
+
try:
|
| 72 |
+
resp = requests.post(url, headers=headers, data=json.dumps(data), timeout=60)
|
| 73 |
+
if not resp.ok:
|
| 74 |
+
print(f"调用trump_process_ctx_api失败: {resp.status_code} {resp.text}")
|
| 75 |
+
return None
|
| 76 |
+
try:
|
| 77 |
+
ctx_json = resp.json()
|
| 78 |
+
except Exception as e:
|
| 79 |
+
print(f"解析trump_process_ctx_api返回异常: {e}")
|
| 80 |
+
return None
|
| 81 |
+
if not ctx_json or ctx_json.get("code") != 0 or not ctx_json.get("data") or not ctx_json["data"].get("task_id"):
|
| 82 |
+
print(f"trump_process_ctx_api返回异常: {ctx_json}")
|
| 83 |
+
return None
|
| 84 |
+
return {
|
| 85 |
+
"task_id": ctx_json["data"]["task_id"],
|
| 86 |
+
"uuid": ctx_json["data"]["task_uuid"],
|
| 87 |
+
"status": "created",
|
| 88 |
+
"message": "任务创建成功,后台处理中"
|
| 89 |
+
}
|
| 90 |
+
except Exception as err:
|
| 91 |
+
print(f"create_task_v3异常: {err}")
|
| 92 |
+
return None
|
| 93 |
+
|
| 94 |
+
def get_task_result(task_id):
|
| 95 |
+
# Poll for task status and result
|
| 96 |
+
url = f"{TrumpAiUrl}/api/task-status/uuid/{task_id}"
|
| 97 |
+
headers = {
|
| 98 |
+
"Content-Type": "application/json",
|
| 99 |
+
"Authorization": f"Bearer {ApiKey}"
|
| 100 |
+
}
|
| 101 |
+
print(url)
|
| 102 |
+
try:
|
| 103 |
+
resp = requests.get(url, headers=headers, timeout=30)
|
| 104 |
+
resp.raise_for_status()
|
| 105 |
+
result = resp.json()
|
| 106 |
+
return result
|
| 107 |
+
except Exception as e:
|
| 108 |
+
return {}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
if __name__ == "__main__":
|
| 112 |
+
|
| 113 |
+
task_type = "voice"
|
| 114 |
+
text = "Hello, this is a test message for Trump AI Voice."
|
| 115 |
+
word_num = 10
|
| 116 |
+
is_rewrite = True
|
| 117 |
+
task_result = create_task_v2(task_type, text, word_num, is_rewrite)
|
| 118 |
+
print(f"task_result: {task_result}")
|