Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,17 +48,15 @@ def get_prompt(file:str):
|
|
| 48 |
with open(file,'r') as f:
|
| 49 |
a=f.readlines()
|
| 50 |
return a #a[0]:positive prompt, a[1] negative prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
def init_pipe():
|
| 53 |
-
def unwarp_model(state_dict):
|
| 54 |
-
new_state_dict = {}
|
| 55 |
-
for key in state_dict:
|
| 56 |
-
new_state_dict[key.split('module.')[1]] = state_dict[key]
|
| 57 |
-
return new_state_dict
|
| 58 |
|
| 59 |
i2v=True
|
| 60 |
-
root_path="./"
|
| 61 |
-
training_steps=0
|
| 62 |
|
| 63 |
if i2v:
|
| 64 |
key = "i2v"
|
|
@@ -179,7 +177,7 @@ def inference(source_images,
|
|
| 179 |
|
| 180 |
return video
|
| 181 |
|
| 182 |
-
def process_video(video_file, image_file, positive_prompt, negative_prompt, guidance, random_seed, choice, progress=
|
| 183 |
if choice==33:
|
| 184 |
video_shard=1
|
| 185 |
elif choice==65:
|
|
@@ -210,7 +208,7 @@ def process_video(video_file, image_file, positive_prompt, negative_prompt, guid
|
|
| 210 |
video:List[PIL.Image.Image]=[]
|
| 211 |
|
| 212 |
|
| 213 |
-
for i in tqdm(range(video_shard)):
|
| 214 |
if i>0: #first frame guidence
|
| 215 |
first_frame=transforms.ToTensor()(video[-1])
|
| 216 |
first_frame = first_frame*255.0
|
|
@@ -281,7 +279,7 @@ with gr.Blocks() as demo:
|
|
| 281 |
cache_examples=False
|
| 282 |
)
|
| 283 |
|
| 284 |
-
demo.launch()
|
| 285 |
"""
|
| 286 |
import gradio as gr
|
| 287 |
import spaces
|
|
|
|
| 48 |
with open(file,'r') as f:
|
| 49 |
a=f.readlines()
|
| 50 |
return a #a[0]:positive prompt, a[1] negative prompt
|
| 51 |
+
def unwarp_model(state_dict):
|
| 52 |
+
new_state_dict = {}
|
| 53 |
+
for key in state_dict:
|
| 54 |
+
new_state_dict[key.split('module.')[1]] = state_dict[key]
|
| 55 |
+
return new_state_dict
|
| 56 |
|
| 57 |
def init_pipe():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
i2v=True
|
|
|
|
|
|
|
| 60 |
|
| 61 |
if i2v:
|
| 62 |
key = "i2v"
|
|
|
|
| 177 |
|
| 178 |
return video
|
| 179 |
|
| 180 |
+
def process_video(video_file, image_file, positive_prompt, negative_prompt, guidance, random_seed, choice, progress=gr.Progress(track_tqdm=True))->str:
|
| 181 |
if choice==33:
|
| 182 |
video_shard=1
|
| 183 |
elif choice==65:
|
|
|
|
| 208 |
video:List[PIL.Image.Image]=[]
|
| 209 |
|
| 210 |
|
| 211 |
+
for i in progress.tqdm(range(video_shard)):
|
| 212 |
if i>0: #first frame guidence
|
| 213 |
first_frame=transforms.ToTensor()(video[-1])
|
| 214 |
first_frame = first_frame*255.0
|
|
|
|
| 279 |
cache_examples=False
|
| 280 |
)
|
| 281 |
|
| 282 |
+
demo.queue().launch()
|
| 283 |
"""
|
| 284 |
import gradio as gr
|
| 285 |
import spaces
|