Spaces:
Runtime error
Runtime error
File size: 1,496 Bytes
d1bdeae f05ea81 d1bdeae 4e50bb4 817689e 9836b6f 7df26b0 c48e116 596da82 efe6971 d1bdeae 72a595f 6ee36a3 d1bdeae 800faba d1bdeae 6769fa2 1e289e1 6ee36a3 6769fa2 429cf3a d1bdeae dd78709 d1bdeae 72a595f d1bdeae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import gradio as gr
import os
import sys
os.system("mkdir pose2pose")
os.system("cd pose2pose")
os.system("mkdir -p datasets/DeepFashion")
os.system("mkdir -p output/DeepFashion/ckpt/pretrained")
os.system("git clone https://github.com/prasunroy/pose-transfer.git")
os.system("cd pose-transfer")
os.system("pip install -r requirements.txt")
sys.path.append("pose-transfer")
import torch
from api import Pose2Pose
from PIL import Image
p2p = Pose2Pose(pretrained=True)
def infer(con_im,ref_im):
condition = Image.open(con_im)
reference = Image.open(ref_im)
generated = p2p.transfer_as(condition, reference)
#generated.show()
return generated
def transf(inp):
return inp
with gr.Blocks() as app:
gr.Markdown("<center><h1 style='font-size:xxx-large;'>Pose Transfer Demo</h1><br><h3>repo: <a href='https://github.com/prasunroy/pose-transfer'>https://github.com/prasunroy/pose-transfer</a></h3>")
with gr.Row():
condition_im = gr.Image(type='filepath',label='Style Image')
reference_im = gr.Image(type='filepath',label='Pose Image')
with gr.Accordion("Pose Maker",open=False):
trans_box=gr.Textbox(label="Paste Generated Pose Image URL> HERE")
pose_maker=gr.HTML("<iframe src='https://omnibus-model-mover.hf.space' width='100%' height='520'></iframe>")
btn=gr.Button()
output_im = gr.Image()
trans_box.change(transf,trans_box,reference_im)
btn.click(infer,[condition_im,reference_im], output_im)
app.launch() |