File size: 3,333 Bytes
8d1ec02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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()