NihalGazi commited on
Commit
f73f7d4
1 Parent(s): d24c394

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -0
app.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_client import Client, handle_file
3
+
4
+ def generate_video(input_image, prompt, negative_prompt, diffusion_step, height, width, scfg_scale, use_dctinit, dct_coefficients, noise_level, motion_bucket_id, seed):
5
+ client = Client("maxin-cn/Cinemo")
6
+
7
+ result = client.predict(
8
+ input_image=handle_file(input_image),
9
+ prompt=prompt,
10
+ negative_prompt=negative_prompt,
11
+ diffusion_step=diffusion_step,
12
+ height=height,
13
+ width=width,
14
+ scfg_scale=scfg_scale,
15
+ use_dctinit=use_dctinit,
16
+ dct_coefficients=dct_coefficients,
17
+ noise_level=noise_level,
18
+ motion_bucket_id=motion_bucket_id,
19
+ seed=seed,
20
+ api_name="/gen_video"
21
+ )
22
+
23
+ return result
24
+
25
+ # Define the Gradio interface
26
+ with gr.Blocks() as demo:
27
+ with gr.Row():
28
+ input_image = gr.Image(label="Input Image", type="filepath", tool="editor")
29
+ with gr.Column():
30
+ prompt = gr.Textbox(label="Prompt", placeholder="Enter prompt here...")
31
+ negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here...")
32
+
33
+ diffusion_step = gr.Slider(minimum=1, maximum=100, default=50, label="Diffusion Steps")
34
+ height = gr.Slider(minimum=128, maximum=1024, default=320, label="Height")
35
+ width = gr.Slider(minimum=128, maximum=1024, default=512, label="Width")
36
+ scfg_scale = gr.Slider(minimum=1.0, maximum=20.0, default=7.5, label="CFG Scale")
37
+ use_dctinit = gr.Checkbox(value=True, label="Enable DCTInit")
38
+ dct_coefficients = gr.Slider(minimum=0.0, maximum=1.0, default=0.23, label="DCT Coefficients")
39
+ noise_level = gr.Slider(minimum=0, maximum=1000, default=985, label="Noise Level")
40
+ motion_bucket_id = gr.Slider(minimum=1, maximum=100, default=10, label="Motion Intensity")
41
+ seed = gr.Slider(minimum=1, maximum=10000, default=100, label="Seed")
42
+
43
+ generate_btn = gr.Button("Generate Video")
44
+
45
+ output_video = gr.Video(label="Generated Video")
46
+
47
+ generate_btn.click(generate_video, inputs=[input_image, prompt, negative_prompt, diffusion_step, height, width, scfg_scale, use_dctinit, dct_coefficients, noise_level, motion_bucket_id, seed], outputs=output_video)
48
+
49
+ # Launch the app
50
+ demo.launch()