Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import torch | |
| from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler | |
| from diffusers.utils import export_to_video | |
| # शिव AI - मॉडल सेटअप | |
| pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16") | |
| pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) | |
| if torch.cuda.is_available(): | |
| pipe.enable_model_cpu_offload() | |
| def generate_video(prompt): | |
| # वीडियो जनरेशन प्रोसेस | |
| video_frames = pipe(prompt, num_inference_steps=25).frames | |
| video_path = export_to_video(video_frames) | |
| return video_path | |
| # शिव AI इंटरफ़ेस | |
| with gr.Blocks() as demo: | |
| gr.Markdown("## शिव एआई (Shiv AI) - टेक्स्ट टू वीडियो जनरेटर") | |
| gr.Markdown("स्वामी: **श्री राम नाग (Shri Ram Nag)**") | |
| with gr.Row(): | |
| input_text = gr.Textbox(label="यहाँ लिखें", placeholder="जैसे: दौड़ता हुआ शेर") | |
| submit_btn = gr.Button("वीडियो बनाएँ") | |
| video_output = gr.Video(label="आपका वीडियो") | |
| submit_btn.click(fn=generate_video, inputs=input_text, outputs=video_output) | |
| demo.launch() | |