Update app.py
Browse files
app.py
CHANGED
|
@@ -67,6 +67,29 @@ def add_new_image(image):
|
|
| 67 |
configs.write(img_settings)
|
| 68 |
configs.truncate()
|
| 69 |
configs.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
@spaces.GPU
|
| 72 |
def run(duration=240):
|
|
|
|
| 67 |
configs.write(img_settings)
|
| 68 |
configs.truncate()
|
| 69 |
configs.seek(0)
|
| 70 |
+
|
| 71 |
+
def add_new_video(image):
|
| 72 |
+
image = Image.fromarray(image)
|
| 73 |
+
height = image.height
|
| 74 |
+
width = image.width
|
| 75 |
+
lr = height/width
|
| 76 |
+
ip_img = "${.condition_images}"
|
| 77 |
+
image.save("./img.png")
|
| 78 |
+
img_settings = f"""- condition_images: ./img.png
|
| 79 |
+
eye_blinks_factor: 1.8
|
| 80 |
+
height: {height}
|
| 81 |
+
img_length_ratio: {lr}
|
| 82 |
+
ipadapter_image: {ip_img}
|
| 83 |
+
name: image
|
| 84 |
+
prompt: (masterpiece, best quality, highres:1),(1person, solo:1),(eye blinks:1.8),(head wave:1.3)
|
| 85 |
+
refer_image: {ip_img}
|
| 86 |
+
video_path: null
|
| 87 |
+
width: {width}"""
|
| 88 |
+
print(img_settings)
|
| 89 |
+
with open ("/home/user/app/MuseV/configs/tasks/example.yaml","r+") as configs:
|
| 90 |
+
configs.write(img_settings)
|
| 91 |
+
configs.truncate()
|
| 92 |
+
configs.seek(0)
|
| 93 |
|
| 94 |
@spaces.GPU
|
| 95 |
def run(duration=240):
|