Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -233,7 +233,7 @@ class Model:
|
|
233 |
imgs.append(temp_img)
|
234 |
return imgs
|
235 |
|
236 |
-
# video
|
237 |
def gen_video(self, w1, w2, noise, path, frame_num=10):
|
238 |
video = imageio.get_writer(path, mode='I', fps=frame_num // 2, codec='libx264', bitrate='16M')
|
239 |
lin = np.linspace(0, 1, frame_num)
|
@@ -243,7 +243,7 @@ class Model:
|
|
243 |
video.close()
|
244 |
|
245 |
|
246 |
-
# video
|
247 |
def gen_video2(self, w1, w2, noise, path, frame_num=10):
|
248 |
video = imageio.get_writer(path, mode='I', fps=frame_num // 2, codec='libx264', bitrate='16M')
|
249 |
lin = np.linspace(0, 1, frame_num)
|
@@ -286,7 +286,7 @@ def gen_video_fn(w1, w2, noise, frame):
|
|
286 |
return None
|
287 |
# model.gen_video(w1, w2, noise, "video.mp4", int(frame))
|
288 |
model.gen_video2(w1, w2, noise, "video.mp4", int(frame))
|
289 |
-
return "
|
290 |
|
291 |
|
292 |
if __name__ == '__main__':
|
@@ -295,7 +295,7 @@ if __name__ == '__main__':
|
|
295 |
app = gr.Blocks()
|
296 |
with app:
|
297 |
gr.Markdown("# full-body anime GAN\nfork from [skytnt](https://huggingface.co/spaces/skytnt/full-body-anime-gan)\n\n"
|
298 |
-
"\ntransformを使った画像生成とブレンドです(text2image, Stable Diffusionではありません)\n
|
299 |
with gr.Tabs():
|
300 |
with gr.TabItem("generate image 新規画像生成"):
|
301 |
with gr.Row():
|
@@ -317,7 +317,7 @@ if __name__ == '__main__':
|
|
317 |
with gr.TabItem("encode image 画像からエンコード"):
|
318 |
with gr.Row():
|
319 |
with gr.Column():
|
320 |
-
gr.Markdown("you'd better upload a standing full-body image")
|
321 |
encode_img_input = gr.Image(label="input image")
|
322 |
examples_data = [[f"examples/{x:02d}.jpg"] for x in range(1, 7)]
|
323 |
encode_img_examples = gr.Dataset(components=[encode_img_input], samples=examples_data)
|
|
|
233 |
imgs.append(temp_img)
|
234 |
return imgs
|
235 |
|
236 |
+
# video 1-2 style
|
237 |
def gen_video(self, w1, w2, noise, path, frame_num=10):
|
238 |
video = imageio.get_writer(path, mode='I', fps=frame_num // 2, codec='libx264', bitrate='16M')
|
239 |
lin = np.linspace(0, 1, frame_num)
|
|
|
243 |
video.close()
|
244 |
|
245 |
|
246 |
+
# video 1-2-1 style
|
247 |
def gen_video2(self, w1, w2, noise, path, frame_num=10):
|
248 |
video = imageio.get_writer(path, mode='I', fps=frame_num // 2, codec='libx264', bitrate='16M')
|
249 |
lin = np.linspace(0, 1, frame_num)
|
|
|
286 |
return None
|
287 |
# model.gen_video(w1, w2, noise, "video.mp4", int(frame))
|
288 |
model.gen_video2(w1, w2, noise, "video.mp4", int(frame))
|
289 |
+
return "video.mp4"
|
290 |
|
291 |
|
292 |
if __name__ == '__main__':
|
|
|
295 |
app = gr.Blocks()
|
296 |
with app:
|
297 |
gr.Markdown("# full-body anime GAN\nfork from [skytnt](https://huggingface.co/spaces/skytnt/full-body-anime-gan)\n\n"
|
298 |
+
"\ntransformを使った画像生成とブレンドです(text2image, Stable Diffusionではありません)\psi1,2はnskytnt/fbanime-ganのmappingパラメータです。\n動画生成は1→2→1というパターンで作ります\n")
|
299 |
with gr.Tabs():
|
300 |
with gr.TabItem("generate image 新規画像生成"):
|
301 |
with gr.Row():
|
|
|
317 |
with gr.TabItem("encode image 画像からエンコード"):
|
318 |
with gr.Row():
|
319 |
with gr.Column():
|
320 |
+
gr.Markdown("you'd better upload a standing full-body image 完全な立ち絵の画像をアップロードしてください")
|
321 |
encode_img_input = gr.Image(label="input image")
|
322 |
examples_data = [[f"examples/{x:02d}.jpg"] for x in range(1, 7)]
|
323 |
encode_img_examples = gr.Dataset(components=[encode_img_input], samples=examples_data)
|