Spaces:
Running
Running
daquanzhou
commited on
Commit
•
c297af0
1
Parent(s):
54a377a
ready
Browse files
app.py
CHANGED
@@ -156,7 +156,7 @@ class MagicMeController:
|
|
156 |
self.id_embed_list = []
|
157 |
self.woman_id_embed_list = ["beyonce", "hermione", "lifeifei", "lisa", "mona", "monroe", "taylor", "scarlett"]
|
158 |
self.refresh_id_embed()
|
159 |
-
|
160 |
with torch.inference_mode():
|
161 |
vaeloader = VAELoader()
|
162 |
self.vaeloader_2 = vaeloader.load_vae(
|
@@ -232,16 +232,9 @@ class MagicMeController:
|
|
232 |
id_embed_list = glob(os.path.join(self.id_embed_dir, "*.pt"))
|
233 |
self.id_embed_list = [Path(p).stem for p in id_embed_list]
|
234 |
|
235 |
-
def update_id_embed(self, id_embed_dropdown):
|
236 |
-
self.selected_id_embed = id_embed_dropdown
|
237 |
-
return gr.Dropdown.update()
|
238 |
-
|
239 |
-
|
240 |
def run_once(self, prompt_text_box, negative_prompt_text_box, id_embed_dropdown, gaussian_slider, seed_text_box):
|
241 |
-
if self.selected_id_embed != id_embed_dropdown: self.update_id_embed(id_embed_dropdown)
|
242 |
-
|
243 |
category = "woman" if self.selected_id_embed in self.woman_id_embed_list else "man"
|
244 |
-
prompt = f"a photo of embedding:{
|
245 |
print("prompt:", prompt)
|
246 |
print("negative_prompt_text_box:", negative_prompt_text_box)
|
247 |
print("id_embed_dropdown:", id_embed_dropdown)
|
@@ -535,6 +528,7 @@ def ui():
|
|
535 |
"""
|
536 |
# Magic-Me: Identity-Specific Video Customized Diffusion
|
537 |
Ze Ma*, Daquan Zhou* †, Chun-Hsiao Yeh, Xue-She Wang, Xiuyu Li, Huanrui Yang, Zhen Dong †, Kurt Keutzer, Jiashi Feng (*Joint First Author, † Corresponding Author)
|
|
|
538 |
[Arxiv Report](https://arxiv.org/abs/2402.09368) | [Project Page](https://magic-me-webpage.github.io/) | [Github](https://github.com/Zhen-Dong/Magic-Me)
|
539 |
"""
|
540 |
)
|
@@ -549,7 +543,6 @@ def ui():
|
|
549 |
with gr.Row():
|
550 |
with gr.Column():
|
551 |
id_embed_dropdown = gr.Dropdown( label="ID Embedding", choices=c.id_embed_list, value=c.id_embed_list[0], interactive=True )
|
552 |
-
id_embed_dropdown.change(fn=c.update_id_embed, inputs=[id_embed_dropdown], outputs=[id_embed_dropdown])
|
553 |
|
554 |
prompt_textbox = gr.Textbox( label="Prompt", info="a photo of <V*> man/woman ", lines=3, value="in superman costume in the outer space, stars in the background" )
|
555 |
negative_prompt_textbox = gr.Textbox( label="Negative Prompt", lines=3, value="(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime), text, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, UnrealisticDream")
|
|
|
156 |
self.id_embed_list = []
|
157 |
self.woman_id_embed_list = ["beyonce", "hermione", "lifeifei", "lisa", "mona", "monroe", "taylor", "scarlett"]
|
158 |
self.refresh_id_embed()
|
159 |
+
|
160 |
with torch.inference_mode():
|
161 |
vaeloader = VAELoader()
|
162 |
self.vaeloader_2 = vaeloader.load_vae(
|
|
|
232 |
id_embed_list = glob(os.path.join(self.id_embed_dir, "*.pt"))
|
233 |
self.id_embed_list = [Path(p).stem for p in id_embed_list]
|
234 |
|
|
|
|
|
|
|
|
|
|
|
235 |
def run_once(self, prompt_text_box, negative_prompt_text_box, id_embed_dropdown, gaussian_slider, seed_text_box):
|
|
|
|
|
236 |
category = "woman" if self.selected_id_embed in self.woman_id_embed_list else "man"
|
237 |
+
prompt = f"a photo of embedding:{id_embed_dropdown} {category} " + prompt_text_box
|
238 |
print("prompt:", prompt)
|
239 |
print("negative_prompt_text_box:", negative_prompt_text_box)
|
240 |
print("id_embed_dropdown:", id_embed_dropdown)
|
|
|
528 |
"""
|
529 |
# Magic-Me: Identity-Specific Video Customized Diffusion
|
530 |
Ze Ma*, Daquan Zhou* †, Chun-Hsiao Yeh, Xue-She Wang, Xiuyu Li, Huanrui Yang, Zhen Dong †, Kurt Keutzer, Jiashi Feng (*Joint First Author, † Corresponding Author)
|
531 |
+
|
532 |
[Arxiv Report](https://arxiv.org/abs/2402.09368) | [Project Page](https://magic-me-webpage.github.io/) | [Github](https://github.com/Zhen-Dong/Magic-Me)
|
533 |
"""
|
534 |
)
|
|
|
543 |
with gr.Row():
|
544 |
with gr.Column():
|
545 |
id_embed_dropdown = gr.Dropdown( label="ID Embedding", choices=c.id_embed_list, value=c.id_embed_list[0], interactive=True )
|
|
|
546 |
|
547 |
prompt_textbox = gr.Textbox( label="Prompt", info="a photo of <V*> man/woman ", lines=3, value="in superman costume in the outer space, stars in the background" )
|
548 |
negative_prompt_textbox = gr.Textbox( label="Negative Prompt", lines=3, value="(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime), text, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, UnrealisticDream")
|