Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import time | |
| # ---------------- CONFIG ---------------- | |
| GET_KEY_URL = "https://adrinolinks.com/cTjV" | |
| # ---------------- LOGIC ---------------- | |
| def generate_video(prompt, key): | |
| time.sleep(1.2) # simulate processing | |
| if not prompt.strip() and not key.strip(): | |
| return None, "❌ Prompt can't be empty and API key is required." | |
| if not prompt.strip(): | |
| return None, "❌ Prompt can't be empty." | |
| if not key.strip(): | |
| return None, "❌ Please enter your API key." | |
| # Both filled → always invalid key | |
| return None, "❌ Invalid API Key. Please get a valid key to generate." | |
| # ---------------- UI ---------------- | |
| with gr.Blocks(css=""" | |
| body { | |
| background: linear-gradient(135deg, #0f0f0f, #1a1a1a); | |
| font-family: 'Segoe UI', sans-serif; | |
| color: white; | |
| } | |
| .glass { | |
| background: rgba(255,255,255,0.08); | |
| backdrop-filter: blur(14px); | |
| border-radius: 20px; | |
| padding: 25px; | |
| } | |
| button { | |
| border-radius: 14px !important; | |
| font-weight: bold; | |
| } | |
| .generate-btn { | |
| background: linear-gradient(90deg,#ff416c,#ff4b2b) !important; | |
| color: white !important; | |
| } | |
| .key-card { | |
| margin-top: 20px; | |
| padding: 20px; | |
| border-radius: 18px; | |
| background: linear-gradient(135deg, rgba(0,114,255,0.15), rgba(0,198,255,0.15)); | |
| border: 1px solid rgba(0,198,255,0.4); | |
| text-align: center; | |
| animation: floaty 3s ease-in-out infinite; | |
| } | |
| @keyframes floaty { | |
| 0% { transform: translateY(0px); } | |
| 50% { transform: translateY(-6px); } | |
| 100% { transform: translateY(0px); } | |
| } | |
| .key-btn-pro { | |
| width: 100%; | |
| height: 52px; | |
| font-size: 16px; | |
| font-weight: bold; | |
| border-radius: 14px; | |
| border: none; | |
| cursor: pointer; | |
| color: white; | |
| background: linear-gradient(90deg, #00c6ff, #0072ff, #00c6ff); | |
| background-size: 200% 200%; | |
| animation: glow 2.5s linear infinite; | |
| } | |
| @keyframes glow { | |
| 0% { background-position: 0% 50%; } | |
| 100% { background-position: 200% 50%; } | |
| } | |
| .key-btn-pro:hover { | |
| transform: scale(1.04); | |
| box-shadow: 0 0 25px rgba(0,198,255,0.8); | |
| } | |
| footer {display:none !important;} | |
| video {border-radius:16px;} | |
| """) as demo: | |
| # ---------------- HEADER ---------------- | |
| gr.Markdown(""" | |
| <div style="text-align:center"> | |
| <h1>🎬 Veo‑3 AI Video Generator</h1> | |
| <p>One‑click cinematic AI video generation (Demo Version)</p> | |
| </div> | |
| """) | |
| # ---------------- DEMO VIDEOS ---------------- | |
| gr.Markdown("## 🔥 Example Generated Videos") | |
| with gr.Row(): | |
| gr.Video("demo1.mp4", label="Cinematic City") | |
| gr.Video("demo2.mp4", label="AI Character") | |
| gr.Video("demo3.mp4", label="Nature Scene") | |
| gr.Markdown(""" | |
| ⚠️ These are **demo previews only**, not real generation. | |
| """) | |
| # ---------------- GENERATOR CARD ---------------- | |
| with gr.Column(elem_classes="glass"): | |
| prompt = gr.Textbox( | |
| label="🎥 Video Prompt", | |
| placeholder="A cinematic robot walking in neon city, ultra realistic, 4K" | |
| ) | |
| key = gr.Textbox( | |
| label="🔑 Veo‑3 API Key", | |
| placeholder="Paste your key here", | |
| type="password" | |
| ) | |
| with gr.Row(): | |
| generate_btn = gr.Button("🚀 Generate Video", elem_classes="generate-btn") | |
| # ---------- ANIMATED GET KEY CARD ---------- | |
| get_key_btn = gr.HTML(f""" | |
| <div class="key-card"> | |
| <p style="font-size:15px; opacity:0.9; margin-bottom:10px;"> | |
| 🔐 Free Veo‑3 API Key Required | |
| </p> | |
| <a href="{GET_KEY_URL}" target="_blank" style="text-decoration:none;"> | |
| <button class="key-btn-pro"> | |
| 🚀 Get Free Key (Instant Access) | |
| </button> | |
| </a> | |
| <p style="font-size:12px; opacity:0.7; margin-top:10px;"> | |
| Key required for video generation | |
| </p> | |
| </div> | |
| """) | |
| output_video = gr.Video(label="🎞 Generated Video") | |
| status = gr.Markdown("") | |
| generate_btn.click( | |
| fn=generate_video, | |
| inputs=[prompt, key], | |
| outputs=[output_video, status] | |
| ) | |
| # ---------------- FOOTER ---------------- | |
| gr.Markdown(""" | |
| <div style="text-align:center;opacity:0.7;margin-top:30px"> | |
| <p>🚧 Demo Space • No real API connected</p> | |
| <p>Made with ❤️ by Prince</p> | |
| </div> | |
| """) | |
| demo.launch() |