Spaces:
Running
Running
Update gradio_app.py
Browse files- gradio_app.py +4 -6
gradio_app.py
CHANGED
|
@@ -18,7 +18,7 @@ from torch.hub import download_url_to_file
|
|
| 18 |
from src.ic_light import BGSource
|
| 19 |
from src.animatediff_pipe import AnimateDiffVideoToVideoPipeline
|
| 20 |
from src.ic_light_pipe import StableDiffusionImg2ImgPipeline
|
| 21 |
-
from utils.tools import read_video
|
| 22 |
|
| 23 |
from huggingface_hub import snapshot_download, hf_hub_download
|
| 24 |
|
|
@@ -247,6 +247,7 @@ def main(args):
|
|
| 247 |
results_path = f"{save_path}/relight_{video_name}"
|
| 248 |
imageio.mimwrite(results_path, frames, fps=8)
|
| 249 |
print(f"relight with bg generation! prompt:{relight_prompt}, light:{bg_source.value}, save in {results_path}.")
|
|
|
|
| 250 |
|
| 251 |
def infer(n_prompt, relight_prompt, video_path, bg_source, save_path,
|
| 252 |
width, height, strength, gamma, num_step, text_guide_scale, seed):
|
|
@@ -280,10 +281,7 @@ def infer(n_prompt, relight_prompt, video_path, bg_source, save_path,
|
|
| 280 |
self.config = config_path
|
| 281 |
|
| 282 |
args = Args()
|
| 283 |
-
main(args)
|
| 284 |
-
|
| 285 |
-
video_name = os.path.basename(video_path)
|
| 286 |
-
results_path = f"{save_path}/relight_{video_name}"
|
| 287 |
os.remove(config_path)
|
| 288 |
|
| 289 |
return results_path
|
|
@@ -307,7 +305,7 @@ with gr.Blocks() as demo:
|
|
| 307 |
text_guide_scale = gr.Number(label="Text Guide Scale", value=2)
|
| 308 |
seed = gr.Number(label="Seed", value=2060)
|
| 309 |
|
| 310 |
-
output = gr.
|
| 311 |
submit = gr.Button("Run")
|
| 312 |
submit.click(infer, inputs=[n_prompt, relight_prompt, video_path, bg_source, save_path,
|
| 313 |
width, height, strength, gamma, num_step, text_guide_scale, seed],
|
|
|
|
| 18 |
from src.ic_light import BGSource
|
| 19 |
from src.animatediff_pipe import AnimateDiffVideoToVideoPipeline
|
| 20 |
from src.ic_light_pipe import StableDiffusionImg2ImgPipeline
|
| 21 |
+
from utils.tools import read_video, set_all_seed
|
| 22 |
|
| 23 |
from huggingface_hub import snapshot_download, hf_hub_download
|
| 24 |
|
|
|
|
| 247 |
results_path = f"{save_path}/relight_{video_name}"
|
| 248 |
imageio.mimwrite(results_path, frames, fps=8)
|
| 249 |
print(f"relight with bg generation! prompt:{relight_prompt}, light:{bg_source.value}, save in {results_path}.")
|
| 250 |
+
return results_path
|
| 251 |
|
| 252 |
def infer(n_prompt, relight_prompt, video_path, bg_source, save_path,
|
| 253 |
width, height, strength, gamma, num_step, text_guide_scale, seed):
|
|
|
|
| 281 |
self.config = config_path
|
| 282 |
|
| 283 |
args = Args()
|
| 284 |
+
results_path= main(args)
|
|
|
|
|
|
|
|
|
|
| 285 |
os.remove(config_path)
|
| 286 |
|
| 287 |
return results_path
|
|
|
|
| 305 |
text_guide_scale = gr.Number(label="Text Guide Scale", value=2)
|
| 306 |
seed = gr.Number(label="Seed", value=2060)
|
| 307 |
|
| 308 |
+
output = gr.Video(label="Results Path")
|
| 309 |
submit = gr.Button("Run")
|
| 310 |
submit.click(infer, inputs=[n_prompt, relight_prompt, video_path, bg_source, save_path,
|
| 311 |
width, height, strength, gamma, num_step, text_guide_scale, seed],
|