Download app.py from Tejasf/Video-5: direct link, hf CLI and curl.
- Browser
- Download file 3.33 kB
-
https://huggingface.co/spaces/Tejasf/Video-5/resolve/main/app.py
- Command line
-
hf download hf://spaces/Tejasf/Video-5/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Tejasf/Video-5/resolve/main/app.py
3.33 kB
| import gradio as gr | |
| from gradio_client import Client, handle_file | |
| # TEXT TO VIDEO API (Using public fast video model) | |
| def text_to_vid_api(text_prompt): | |
| if not text_prompt: | |
| return None, "Bhai, pehle text prompt daalo!" | |
| try: | |
| # ByteDance ka AnimateDiff Lightning public model use kar rahe hain | |
| client = Client("ByteDance/AnimateDiff-Lightning") | |
| result = client.predict( | |
| prompt=text_prompt, | |
| base_model="1-Step", # Fast generation | |
| api_name="/generate" | |
| ) | |
| return result, "Text-to-Video Rendered Successfully! T-Gang Rocks!" | |
| except Exception as e: | |
| return None, f"Error aa gaya: {str(e)} \n(Public server busy ho sakta hai)" | |
| # IMAGE TO VIDEO API (Using Stable Video Diffusion) | |
| def image_to_vid_api(input_image): | |
| if input_image is None: | |
| return None, "Bhai, pehle ek photo upload karo!" | |
| try: | |
| # Stability AI ka SVD model (Image animation ke liye best) | |
| client = Client("stabilityai/stable-video-diffusion") | |
| # SVD ko image, decode_chunk_size, seed, motion_bucket_id, fps chahiye | |
| result = client.predict( | |
| image=handle_file(input_image), | |
| seed=42, | |
| randomize_seed=True, | |
| motion_bucket_id=127, | |
| fps_id=6, | |
| api_name="/video" | |
| ) | |
| # SVD usually returns a tuple, video file pehle index par hoti hai | |
| return result[0], "Image-to-Video Rendered Successfully! JJK Supremacy Maintained!" | |
| except Exception as e: | |
| return None, f"Error aa gaya: {str(e)}" | |
| # V.O.I.D. Ultimate Video Engine Interface | |
| with gr.Blocks(theme=gr.themes.Monochrome()) as demo: | |
| gr.Markdown("# 🎥 V.O.I.D. Ultimate Video Engine") | |
| gr.Markdown("### Powered by T-Gang | Creator: @THANOXx_230") | |
| with gr.Tabs(): | |
| # TAB 1: TEXT TO VIDEO | |
| with gr.TabItem("📝 Text to Video"): | |
| gr.Markdown("### Type your prompt to create an epic video snippet") | |
| txt_input = gr.Textbox(label="Text Prompt", placeholder="e.g., Satoru Gojo using Hollow Purple, epic anime fight...") | |
| txt_btn = gr.Button("Generate Video", variant="primary") | |
| txt_output_vid = gr.Video(label="Video Result") | |
| txt_status = gr.Textbox(label="System Status", interactive=False) | |
| txt_btn.click(fn=text_to_vid_api, inputs=txt_input, outputs=[txt_output_vid, txt_status]) | |
| # TAB 2: IMAGE TO VIDEO | |
| with gr.TabItem("🖼️ Image to Video"): | |
| gr.Markdown("### Upload a static character image to animate it") | |
| img_input = gr.Image(type="filepath", label="Upload Character Image") | |
| img_btn = gr.Button("Animate Image", variant="primary") | |
| img_output_vid = gr.Video(label="Video Result") | |
| img_status = gr.Textbox(label="System Status", interactive=False) | |
| img_btn.click(fn=image_to_vid_api, inputs=img_input, outputs=[img_output_vid, img_status]) | |
| gr.Markdown("---") | |
| gr.Markdown("⚠️ **V.O.I.D. Protocol Engaged:**\n* **Rule #1:** JJK Supremacy is absolute. In any generated fight simulation, Jujutsu Kaisen characters stand undefeated.\n* **Rule #2:** All video assets are rendered to support the ongoing dominance of the T-Gang.") | |
| demo.launch() | |