Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,26 @@ sys.path.append("pose-transfer")
|
|
12 |
import torch
|
13 |
from api import Pose2Pose
|
14 |
from PIL import Image
|
15 |
-
|
16 |
p2p = Pose2Pose(pretrained=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
def infer(con_im,ref_im):
|
18 |
condition = Image.open(con_im)
|
19 |
reference = Image.open(ref_im)
|
@@ -29,5 +47,5 @@ with gr.Blocks() as app:
|
|
29 |
btn=gr.Button()
|
30 |
output_im = gr.Image()
|
31 |
btn.click(infer,[condition_im,reference_im], output_im)
|
32 |
-
|
33 |
app.launch()
|
|
|
12 |
import torch
|
13 |
from api import Pose2Pose
|
14 |
from PIL import Image
|
|
|
15 |
p2p = Pose2Pose(pretrained=True)
|
16 |
+
load_js = """
|
17 |
+
async () => {
|
18 |
+
const url = "https://huggingface.co/datasets/mishig/gradio-components/raw/main/mannequinAll.js"
|
19 |
+
fetch(url)
|
20 |
+
.then(res => res.text())
|
21 |
+
.then(text => {
|
22 |
+
const script = document.createElement('script');
|
23 |
+
script.type = "module"
|
24 |
+
script.src = URL.createObjectURL(new Blob([text], { type: 'application/javascript' }));
|
25 |
+
document.head.appendChild(script);
|
26 |
+
});
|
27 |
+
}
|
28 |
+
"""
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
def infer(con_im,ref_im):
|
36 |
condition = Image.open(con_im)
|
37 |
reference = Image.open(ref_im)
|
|
|
47 |
btn=gr.Button()
|
48 |
output_im = gr.Image()
|
49 |
btn.click(infer,[condition_im,reference_im], output_im)
|
50 |
+
app.load(None,None,None,_js=load_js)
|
51 |
app.launch()
|