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()