Spaces:
Paused
Paused
test gradio
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ This way, each frame represents a distinct scene, and there’s no redundancy be
|
|
115 |
return conditioning_frames
|
116 |
|
117 |
@spaces.GPU
|
118 |
-
def generate_gif(prompt, reference_image, controlnet_conditioning_scale,num_frames):
|
119 |
massage_history = [{"role": "system", "content": """
|
120 |
You are a scene designer tasked with creating sparse frames of a video. You will be given a prompt describing the desired video, and your goal is to design only the key frames (sparse frames) that represent major changes in the scene. Do not include repetitive or similar scenes—only capture distinct moments.
|
121 |
|
@@ -144,7 +144,7 @@ This way, each frame represents a distinct scene, and there’s no redundancy be
|
|
144 |
conditioning_frames = []
|
145 |
controlnet_frame_indices =[]
|
146 |
for frame in frames:
|
147 |
-
conditioning_frames.append(generate_image(frame['description'], reference_image, float(
|
148 |
controlnet_frame_indices.append(frame['frame_index'])
|
149 |
yield conditioning_frames, "animation.gif"
|
150 |
|
@@ -155,6 +155,7 @@ This way, each frame represents a distinct scene, and there’s no redundancy be
|
|
155 |
conditioning_frames=conditioning_frames,
|
156 |
controlnet_frame_indices=controlnet_frame_indices,
|
157 |
controlnet_conditioning_scale=float(controlnet_conditioning_scale),
|
|
|
158 |
).frames[0]
|
159 |
export_to_gif(video, "output.gif")
|
160 |
|
@@ -168,6 +169,7 @@ interface = gr.Interface(
|
|
168 |
# gr.Image( type= "filepath",label="Reference Image (Style)"),
|
169 |
gr.File(type="filepath",file_count="multiple",label="Reference Image (Style)"),
|
170 |
gr.Slider(label="Control Net Conditioning Scale", minimum=0, maximum=1.0, step=0.1, value=1.0),
|
|
|
171 |
gr.Slider(label="Number of frames", minimum=0, maximum=100.0, step=1.0, value=10.0),
|
172 |
|
173 |
],
|
|
|
115 |
return conditioning_frames
|
116 |
|
117 |
@spaces.GPU
|
118 |
+
def generate_gif(prompt, reference_image, controlnet_conditioning_scale,style_conditioning_scale,num_frames):
|
119 |
massage_history = [{"role": "system", "content": """
|
120 |
You are a scene designer tasked with creating sparse frames of a video. You will be given a prompt describing the desired video, and your goal is to design only the key frames (sparse frames) that represent major changes in the scene. Do not include repetitive or similar scenes—only capture distinct moments.
|
121 |
|
|
|
144 |
conditioning_frames = []
|
145 |
controlnet_frame_indices =[]
|
146 |
for frame in frames:
|
147 |
+
conditioning_frames.append(generate_image(frame['description'], reference_image, float(style_conditioning_scale)))
|
148 |
controlnet_frame_indices.append(frame['frame_index'])
|
149 |
yield conditioning_frames, "animation.gif"
|
150 |
|
|
|
155 |
conditioning_frames=conditioning_frames,
|
156 |
controlnet_frame_indices=controlnet_frame_indices,
|
157 |
controlnet_conditioning_scale=float(controlnet_conditioning_scale),
|
158 |
+
num_frames=max(controlnet_frame_indices+1),
|
159 |
).frames[0]
|
160 |
export_to_gif(video, "output.gif")
|
161 |
|
|
|
169 |
# gr.Image( type= "filepath",label="Reference Image (Style)"),
|
170 |
gr.File(type="filepath",file_count="multiple",label="Reference Image (Style)"),
|
171 |
gr.Slider(label="Control Net Conditioning Scale", minimum=0, maximum=1.0, step=0.1, value=1.0),
|
172 |
+
gr.Slider(label="Style Scale", minimum=0, maximum=1.0, step=0.1, value=1.0),
|
173 |
gr.Slider(label="Number of frames", minimum=0, maximum=100.0, step=1.0, value=10.0),
|
174 |
|
175 |
],
|