Spaces:
Running
on
A10G
Running
on
A10G
init
Browse files- app.py +38 -6
- configs/inference_video_320_512.yaml +2 -2
- header.html +3 -3
app.py
CHANGED
@@ -162,11 +162,13 @@ def read_content(file_path: str) -> str:
|
|
162 |
return content
|
163 |
|
164 |
|
165 |
-
|
166 |
['eval_data/3d_1.png', 'A bouquet of flowers in a vase.', 'image', 123, 1.0, 50],
|
167 |
['eval_data/craft_1.jpg', 'A modern cityscape with towering skyscrapers.', 'image', 124, 1.0, 50],
|
168 |
['eval_data/digital_art_2.jpeg', 'A lighthouse standing tall on a rocky coast.', 'image', 123, 1.0, 50],
|
169 |
['eval_data/oil_paint_2.jpg', 'A man playing the guitar on a city street.', 'image', 123, 1.0, 50],
|
|
|
|
|
170 |
['eval_data/craft_2.png', 'City street at night with bright lights and busy traffic.', 'video', 123, 1.0, 50],
|
171 |
['eval_data/anime_1.jpg', 'A field of sunflowers on a sunny day.', 'video', 123, 1.0, 50],
|
172 |
['eval_data/ink_2.jpeg', 'A knight riding a horse through a field.', 'video', 123, 1.0, 50],
|
@@ -174,14 +176,15 @@ demo_exaples = [
|
|
174 |
['eval_data/icon_1.png', 'A campfire surrounded by tents.', 'video', 123, 1.0, 50],
|
175 |
]
|
176 |
css = """
|
177 |
-
#input_img {max-height:
|
178 |
-
#
|
|
|
179 |
"""
|
180 |
|
181 |
with gr.Blocks(analytics_enabled=False, css=css) as demo_iface:
|
182 |
gr.HTML(read_content("header.html"))
|
183 |
|
184 |
-
with gr.Tab(label='Stylized Generation'):
|
185 |
with gr.Column():
|
186 |
with gr.Row():
|
187 |
with gr.Column():
|
@@ -194,13 +197,42 @@ with gr.Blocks(analytics_enabled=False, css=css) as demo_iface:
|
|
194 |
input_style_strength = gr.Slider(minimum=0.0, maximum=2.0, step=0.01, label='Style Strength', value=1.0)
|
195 |
with gr.Row():
|
196 |
input_step = gr.Slider(minimum=1, maximum=75, step=1, elem_id="i2v_steps", label="Sampling steps", value=50)
|
197 |
-
input_type = gr.Radio(choices=["image"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
input_end_btn = gr.Button("Generate")
|
199 |
# with gr.Tab(label='Result'):
|
200 |
with gr.Row():
|
201 |
output_result = gr.Video(label="Generated Results",elem_id="output_vid",autoplay=True,show_share_button=True)
|
202 |
|
203 |
-
gr.Examples(examples=
|
204 |
inputs=[input_style_ref, input_prompt, input_type, input_seed, input_style_strength, input_step],
|
205 |
outputs=[output_result],
|
206 |
fn = infer,
|
|
|
162 |
return content
|
163 |
|
164 |
|
165 |
+
demo_exaples_image = [
|
166 |
['eval_data/3d_1.png', 'A bouquet of flowers in a vase.', 'image', 123, 1.0, 50],
|
167 |
['eval_data/craft_1.jpg', 'A modern cityscape with towering skyscrapers.', 'image', 124, 1.0, 50],
|
168 |
['eval_data/digital_art_2.jpeg', 'A lighthouse standing tall on a rocky coast.', 'image', 123, 1.0, 50],
|
169 |
['eval_data/oil_paint_2.jpg', 'A man playing the guitar on a city street.', 'image', 123, 1.0, 50],
|
170 |
+
]
|
171 |
+
demo_exaples_video = [
|
172 |
['eval_data/craft_2.png', 'City street at night with bright lights and busy traffic.', 'video', 123, 1.0, 50],
|
173 |
['eval_data/anime_1.jpg', 'A field of sunflowers on a sunny day.', 'video', 123, 1.0, 50],
|
174 |
['eval_data/ink_2.jpeg', 'A knight riding a horse through a field.', 'video', 123, 1.0, 50],
|
|
|
176 |
['eval_data/icon_1.png', 'A campfire surrounded by tents.', 'video', 123, 1.0, 50],
|
177 |
]
|
178 |
css = """
|
179 |
+
#input_img {max-height: 400px}
|
180 |
+
#input_img [data-testid="image"], #input_img [data-testid="image"] > div{max-height: 400px}
|
181 |
+
#output_vid {max-height: 400px;}
|
182 |
"""
|
183 |
|
184 |
with gr.Blocks(analytics_enabled=False, css=css) as demo_iface:
|
185 |
gr.HTML(read_content("header.html"))
|
186 |
|
187 |
+
with gr.Tab(label='Stylized Image Generation'):
|
188 |
with gr.Column():
|
189 |
with gr.Row():
|
190 |
with gr.Column():
|
|
|
197 |
input_style_strength = gr.Slider(minimum=0.0, maximum=2.0, step=0.01, label='Style Strength', value=1.0)
|
198 |
with gr.Row():
|
199 |
input_step = gr.Slider(minimum=1, maximum=75, step=1, elem_id="i2v_steps", label="Sampling steps", value=50)
|
200 |
+
input_type = gr.Radio(choices=["image"], label="Generation Type", value="image")
|
201 |
+
input_end_btn = gr.Button("Generate")
|
202 |
+
# with gr.Tab(label='Result'):
|
203 |
+
with gr.Row():
|
204 |
+
output_result = gr.Image(label="Generated Results",elem_id="output_vid", show_share_button=True)
|
205 |
+
|
206 |
+
gr.Examples(examples=demo_exaples_image,
|
207 |
+
inputs=[input_style_ref, input_prompt, input_type, input_seed, input_style_strength, input_step],
|
208 |
+
outputs=[output_result],
|
209 |
+
fn = infer,
|
210 |
+
)
|
211 |
+
input_end_btn.click(inputs=[input_style_ref, input_prompt, input_type, input_seed, input_style_strength, input_step],
|
212 |
+
outputs=[output_result],
|
213 |
+
fn = infer
|
214 |
+
)
|
215 |
+
|
216 |
+
with gr.Tab(label='Stylized Video Generation'):
|
217 |
+
with gr.Column():
|
218 |
+
with gr.Row():
|
219 |
+
with gr.Column():
|
220 |
+
with gr.Row():
|
221 |
+
input_style_ref = gr.Image(label="Style Reference",elem_id="input_img")
|
222 |
+
with gr.Row():
|
223 |
+
input_prompt = gr.Text(label='Prompts')
|
224 |
+
with gr.Row():
|
225 |
+
input_seed = gr.Slider(label='Random Seed', minimum=0, maximum=1000, step=1, value=123)
|
226 |
+
input_style_strength = gr.Slider(minimum=0.0, maximum=2.0, step=0.01, label='Style Strength', value=1.0)
|
227 |
+
with gr.Row():
|
228 |
+
input_step = gr.Slider(minimum=1, maximum=75, step=1, elem_id="i2v_steps", label="Sampling steps", value=50)
|
229 |
+
input_type = gr.Radio(choices=["video"], label="Generation Type", value="video")
|
230 |
input_end_btn = gr.Button("Generate")
|
231 |
# with gr.Tab(label='Result'):
|
232 |
with gr.Row():
|
233 |
output_result = gr.Video(label="Generated Results",elem_id="output_vid",autoplay=True,show_share_button=True)
|
234 |
|
235 |
+
gr.Examples(examples=demo_exaples_video,
|
236 |
inputs=[input_style_ref, input_prompt, input_type, input_seed, input_style_strength, input_step],
|
237 |
outputs=[output_result],
|
238 |
fn = infer,
|
configs/inference_video_320_512.yaml
CHANGED
@@ -77,14 +77,14 @@ model:
|
|
77 |
cond_stage_config:
|
78 |
target: lvdm.modules.encoders.condition.FrozenOpenCLIPEmbedder
|
79 |
params:
|
80 |
-
version: checkpoints/open_clip/CLIP-ViT-H-14-laion2B-s32B-b79K/open_clip_pytorch_model.bin
|
81 |
freeze: true
|
82 |
layer: "penultimate"
|
83 |
|
84 |
style_stage_config:
|
85 |
target: lvdm.modules.encoders.condition.FrozenOpenCLIPImageEmbedder
|
86 |
params:
|
87 |
-
version: checkpoints/open_clip/CLIP-ViT-H-14-laion2B-s32B-b79K/open_clip_pytorch_model.bin
|
88 |
freeze: true
|
89 |
only_cls: false
|
90 |
use_proj: false
|
|
|
77 |
cond_stage_config:
|
78 |
target: lvdm.modules.encoders.condition.FrozenOpenCLIPEmbedder
|
79 |
params:
|
80 |
+
# version: checkpoints/open_clip/CLIP-ViT-H-14-laion2B-s32B-b79K/open_clip_pytorch_model.bin
|
81 |
freeze: true
|
82 |
layer: "penultimate"
|
83 |
|
84 |
style_stage_config:
|
85 |
target: lvdm.modules.encoders.condition.FrozenOpenCLIPImageEmbedder
|
86 |
params:
|
87 |
+
# version: checkpoints/open_clip/CLIP-ViT-H-14-laion2B-s32B-b79K/open_clip_pytorch_model.bin
|
88 |
freeze: true
|
89 |
only_cls: false
|
90 |
use_proj: false
|
header.html
CHANGED
@@ -16,11 +16,11 @@
|
|
16 |
|
17 |
|
18 |
|
19 |
-
<div style="text-align: center; max-width:
|
20 |
-
<p style="align-items: center; margin-bottom:
|
21 |
This is a online demo for StyleCrafter, a model that can generate images/videos with your favorite style.
|
22 |
</p>
|
23 |
-
<p style="align-items: center; margin-bottom:
|
24 |
You can upload your own style image and text description, and StyleCrafter will intelligently combine the style elements from the image and the text to create a unique and visually appealing output.
|
25 |
</p>
|
26 |
</div>
|
|
|
16 |
|
17 |
|
18 |
|
19 |
+
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
20 |
+
<p style="align-items: center; margin-bottom: 10px;">
|
21 |
This is a online demo for StyleCrafter, a model that can generate images/videos with your favorite style.
|
22 |
</p>
|
23 |
+
<p style="align-items: center; margin-bottom: 10px;">
|
24 |
You can upload your own style image and text description, and StyleCrafter will intelligently combine the style elements from the image and the text to create a unique and visually appealing output.
|
25 |
</p>
|
26 |
</div>
|