Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,106 +1,103 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
|
| 6 |
-
# ----------------
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
<div style="
|
| 12 |
-
padding:18px;
|
| 13 |
-
border-radius:16px;
|
| 14 |
-
background:#fff1f2;
|
| 15 |
-
border:2px solid #ff4d6d;
|
| 16 |
-
color:#800f2f;
|
| 17 |
-
text-align:center;
|
| 18 |
-
font-weight:700;">
|
| 19 |
-
❌ Invalid API key.<br>
|
| 20 |
-
Please get a valid key to generate video.
|
| 21 |
-
</div>
|
| 22 |
-
"""
|
| 23 |
-
)
|
| 24 |
|
| 25 |
# ---------------- UI ----------------
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
with gr.Row():
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
f"""
|
| 52 |
-
<
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
padding:12px 24px;
|
| 57 |
-
border-radius:30px;
|
| 58 |
-
background:linear-gradient(45deg,#ff416c,#ff4b2b);
|
| 59 |
-
color:white;
|
| 60 |
-
font-weight:800;
|
| 61 |
-
box-shadow:0 6px 18px rgba(0,0,0,0.25);">
|
| 62 |
-
🔑 Get Free API Key
|
| 63 |
-
</div>
|
| 64 |
</a>
|
| 65 |
-
</div>
|
| 66 |
"""
|
| 67 |
)
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
"<div style='opacity:0.6;'>Generated video will appear here</div>"
|
| 72 |
-
)
|
| 73 |
-
|
| 74 |
-
generate_btn.click(generate_video, api_key, result)
|
| 75 |
-
|
| 76 |
-
gr.Markdown("## 🎞 Example Generated Videos (Preview Only)")
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
background:#e5e5e5;border-radius:14px;
|
| 83 |
-
display:flex;align-items:center;justify-content:center;">
|
| 84 |
-
Example Video 1
|
| 85 |
-
</div>
|
| 86 |
-
|
| 87 |
-
<div style="width:200px;height:120px;
|
| 88 |
-
background:#e5e5e5;border-radius:14px;
|
| 89 |
-
display:flex;align-items:center;justify-content:center;">
|
| 90 |
-
Example Video 2
|
| 91 |
-
</div>
|
| 92 |
-
|
| 93 |
-
<div style="width:200px;height:120px;
|
| 94 |
-
background:#e5e5e5;border-radius:14px;
|
| 95 |
-
display:flex;align-items:center;justify-content:center;">
|
| 96 |
-
Example Video 3
|
| 97 |
-
</div>
|
| 98 |
-
</div>
|
| 99 |
-
"""
|
| 100 |
)
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import time
|
| 3 |
|
| 4 |
+
# ---------------- CONFIG ----------------
|
| 5 |
+
GET_KEY_URL = "https://adrinolinks.com/cTjV"
|
| 6 |
|
| 7 |
+
# ---------------- FUNCTIONS ----------------
|
| 8 |
+
def generate_video(prompt, key):
|
| 9 |
+
if key.strip() == "":
|
| 10 |
+
return None, "❌ Please paste your Veo‑3 key to generate."
|
| 11 |
|
| 12 |
+
# Always invalid key (as requested)
|
| 13 |
+
time.sleep(2)
|
| 14 |
+
return None, "❌ Invalid API Key. Please get a valid key and try again."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# ---------------- UI ----------------
|
| 17 |
+
with gr.Blocks(css="""
|
| 18 |
+
body {
|
| 19 |
+
background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
|
| 20 |
+
}
|
| 21 |
+
.glass {
|
| 22 |
+
background: rgba(255,255,255,0.08);
|
| 23 |
+
backdrop-filter: blur(14px);
|
| 24 |
+
border-radius: 20px;
|
| 25 |
+
padding: 25px;
|
| 26 |
+
}
|
| 27 |
+
button {
|
| 28 |
+
border-radius: 14px !important;
|
| 29 |
+
font-weight: bold;
|
| 30 |
+
}
|
| 31 |
+
.generate-btn {
|
| 32 |
+
background: linear-gradient(90deg,#ff416c,#ff4b2b) !important;
|
| 33 |
+
color: white !important;
|
| 34 |
+
}
|
| 35 |
+
.key-btn {
|
| 36 |
+
background: linear-gradient(90deg,#00c6ff,#0072ff) !important;
|
| 37 |
+
color: white !important;
|
| 38 |
+
}
|
| 39 |
+
footer {display:none !important;}
|
| 40 |
+
""") as demo:
|
| 41 |
+
|
| 42 |
+
gr.Markdown("""
|
| 43 |
+
<div style="text-align:center">
|
| 44 |
+
<h1>🎬 Veo‑3 AI Video Generator</h1>
|
| 45 |
+
<p>One‑click cinematic AI video generation (Demo Version)</p>
|
| 46 |
+
</div>
|
| 47 |
+
""")
|
| 48 |
+
|
| 49 |
+
# ---------------- DEMO VIDEOS ----------------
|
| 50 |
+
gr.Markdown("## 🔥 Example Generated Videos")
|
| 51 |
|
| 52 |
with gr.Row():
|
| 53 |
+
gr.Video("demo1.mp4", label="Cinematic City")
|
| 54 |
+
gr.Video("demo2.mp4", label="AI Character")
|
| 55 |
+
gr.Video("demo3.mp4", label="Nature Scene")
|
| 56 |
+
|
| 57 |
+
gr.Markdown("""
|
| 58 |
+
⚠️ These are **preview demo videos only**, not real generation.
|
| 59 |
+
""")
|
| 60 |
+
|
| 61 |
+
# ---------------- GENERATOR CARD ----------------
|
| 62 |
+
with gr.Column(elem_classes="glass"):
|
| 63 |
+
prompt = gr.Textbox(
|
| 64 |
+
label="🎥 Video Prompt",
|
| 65 |
+
placeholder="A cinematic robot walking in neon city, ultra realistic, 4K"
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
key = gr.Textbox(
|
| 69 |
+
label="🔑 Veo‑3 API Key",
|
| 70 |
+
placeholder="Paste your key here",
|
| 71 |
+
type="password"
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
with gr.Row():
|
| 75 |
+
generate_btn = gr.Button("🚀 Generate Video", elem_classes="generate-btn")
|
| 76 |
+
get_key_btn = gr.HTML(
|
| 77 |
f"""
|
| 78 |
+
<a href="{GET_KEY_URL}" target="_blank">
|
| 79 |
+
<button class="key-btn" style="width:100%;height:44px;">
|
| 80 |
+
🔑 Get Key
|
| 81 |
+
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
</a>
|
|
|
|
| 83 |
"""
|
| 84 |
)
|
| 85 |
|
| 86 |
+
output_video = gr.Video(label="🎞 Generated Video")
|
| 87 |
+
status = gr.Markdown("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
generate_btn.click(
|
| 90 |
+
fn=generate_video,
|
| 91 |
+
inputs=[prompt, key],
|
| 92 |
+
outputs=[output_video, status]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
)
|
| 94 |
|
| 95 |
+
# ---------------- FOOTER ----------------
|
| 96 |
+
gr.Markdown("""
|
| 97 |
+
<div style="text-align:center;opacity:0.7;margin-top:30px">
|
| 98 |
+
<p>🚧 Demo Space • No real API connected</p>
|
| 99 |
+
<p>Made with ❤️ by Prince</p>
|
| 100 |
+
</div>
|
| 101 |
+
""")
|
| 102 |
|
| 103 |
demo.launch()
|