| import gradio as gr |
| from modelscope.pipelines import pipeline |
| from modelscope.utils.constant import Tasks |
|
|
| |
| video_pipe = pipeline( |
| Tasks.text_to_video_synthesis, |
| model='damo/text-to-video-synthesis', |
| device='cuda' |
| ) |
|
|
| def generate(prompt, image): |
| image_path = "input.png" |
| image.save(image_path) |
| result = video_pipe({ |
| 'text': prompt, |
| 'input_image': image_path |
| }) |
| return result['video_path'] |
|
|
| with gr.Blocks() as demo: |
| gr.Markdown("## 🎬 Text + Image → Shorts-Ready Video") |
| prompt = gr.Textbox(label="🔤 লিখুন (Bengali/English)") |
| image_input = gr.Image(type="pil", label="🖼️ একটি ছবি দিন") |
| video_output = gr.Video(label="🎥 Generated Video") |
| generate_btn = gr.Button("🎞️ ভিডিও তৈরি করুন") |
| generate_btn.click(fn=generate, inputs=[prompt, image_input], outputs=video_output) |
|
|
| demo.launch() |