Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from video_pipeline import generate_video
|
| 3 |
+
from quota_manager import check_quota, increment_quota
|
| 4 |
+
|
| 5 |
+
def full_pipeline(prompt, image):
|
| 6 |
+
if not check_quota():
|
| 7 |
+
return "⚠️ আজকের ৭টি ভিডিও সীমা পূর্ণ হয়েছে।", None
|
| 8 |
+
image_path = "input.png"
|
| 9 |
+
image.save(image_path)
|
| 10 |
+
video_path = generate_video(prompt, image_path)
|
| 11 |
+
increment_quota()
|
| 12 |
+
return "✅ ভিডিও তৈরি হয়েছে!", video_path
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown("## 🎬 Text + Image → Shorts-Ready Video")
|
| 16 |
+
prompt = gr.Textbox(label="🔤 লিখুন (Bengali/English)")
|
| 17 |
+
image_input = gr.Image(type="pil", label="🖼️ একটি ছবি দিন")
|
| 18 |
+
status = gr.Textbox(label="📢 Status")
|
| 19 |
+
video_output = gr.Video(label="🎥 Generated Video")
|
| 20 |
+
generate_btn = gr.Button("🎞️ ভিডিও তৈরি করুন")
|
| 21 |
+
generate_btn.click(fn=full_pipeline, inputs=[prompt, image_input], outputs=[status, video_output])
|
| 22 |
+
|
| 23 |
+
demo.launch()
|