File size: 1,460 Bytes
b1439a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ce1817
b1439a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from huggingface_hub import InferenceClient
import os

# This pulls your token from the "Secrets" we will set in the next step
HF_TOKEN = os.getenv("HF_TOKEN")
client = InferenceClient(api_key=HF_TOKEN)

def generate_motion(image, video):
    if not image or not video:
        return None
    try:
        # Using Wan2.2 (Top open-source motion model of 2026)
        # It takes your image and animates it based on the video
        output = client.image_to_video(
            image=image,
            model="tencent/HunyuanVideo-I2V" # High-quality free inference
        )
        return output
    except Exception as e:
        return f"Error: {str(e)}. Check your 'Secrets' for the HF_TOKEN!"

# Customizing the UI for Demone X YT
with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
    gr.Markdown("# 🎮 Demone X: AI Motion Control")
    gr.Markdown("Transform your gaming characters into life! Upload a photo and a motion video.")
    
    with gr.Row():
        with gr.Column():
            char_img = gr.Image(label="Character Image (BGMI / Sons of the Forest)", type="filepath")
            ref_vid = gr.Video(label="Reference Motion (Upload your move)")
            btn = gr.Button("🔥 Generate AI Motion", variant="primary")
        
        with gr.Column():
            output_video = gr.Video(label="Final AI Edit")

    btn.click(fn=generate_motion, inputs=[char_img, ref_vid], outputs=[output_video])

demo.launch()