Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import io
|
3 |
-
|
|
|
4 |
import gradio as gr
|
5 |
from gradio_client import Client, handle_file
|
6 |
|
@@ -27,7 +28,6 @@ def virtual_tryon(
|
|
27 |
) # handle_file uploads the image :contentReference[oaicite:6]{index=6}
|
28 |
garment_file = handle_file(garment_path)
|
29 |
|
30 |
-
|
31 |
# 3) Build inputs in the exact order shown on the “Use via API” page :contentReference[oaicite:7]{index=7}
|
32 |
|
33 |
# 4) Call the named endpoint with handle_file inputs
|
@@ -51,25 +51,28 @@ def virtual_tryon(
|
|
51 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
52 |
gr.Markdown("## V_TRY DEMO")
|
53 |
with gr.Row():
|
54 |
-
with gr.Column():
|
55 |
-
gr.Markdown("####UPLOAD PERSON IMAGE")
|
56 |
-
src = gr.Image(sources="upload", type="filepath", label="Person Image")
|
57 |
with gr.Column():
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
btn.click(virtual_tryon, [src, ref, garment_type], out)
|
74 |
|
75 |
demo.launch(
|
@@ -78,4 +81,3 @@ demo.launch(
|
|
78 |
pwa=True,
|
79 |
view_api=False
|
80 |
)
|
81 |
-
|
|
|
1 |
import os
|
2 |
import io
|
3 |
+
# Workaround for PIL/Gradio bug :contentReference[oaicite:13]{index=13}
|
4 |
+
import PIL.Image
|
5 |
import gradio as gr
|
6 |
from gradio_client import Client, handle_file
|
7 |
|
|
|
28 |
) # handle_file uploads the image :contentReference[oaicite:6]{index=6}
|
29 |
garment_file = handle_file(garment_path)
|
30 |
|
|
|
31 |
# 3) Build inputs in the exact order shown on the “Use via API” page :contentReference[oaicite:7]{index=7}
|
32 |
|
33 |
# 4) Call the named endpoint with handle_file inputs
|
|
|
51 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
52 |
gr.Markdown("## V_TRY DEMO")
|
53 |
with gr.Row():
|
|
|
|
|
|
|
54 |
with gr.Column():
|
55 |
+
gr.Markdown("####UPLOAD PERSON IMAGE")
|
56 |
+
src = gr.Image(sources="upload", type="filepath",
|
57 |
+
label="Person Image")
|
58 |
+
with gr.Column():
|
59 |
+
gr, Markdown("####UPLOAD GARMENT IMAGE")
|
60 |
+
ref = gr.Image(sources="upload", type="filepath",
|
61 |
+
label="Garment Image")
|
62 |
+
with gr.Column():
|
63 |
+
gr.Markdown("####Select the Garment type")
|
64 |
+
garment_type = gr.Radio(
|
65 |
+
choices=[("Upper", "upper_body"),
|
66 |
+
("Lower", "lower_body"), ("Dress", "dresses")],
|
67 |
+
value="upper_body",
|
68 |
+
label="Garment Type",
|
69 |
+
)
|
70 |
+
with gr.Column():
|
71 |
+
gr.Markdown("####Output Image")
|
72 |
+
out = gr.Image(type="filepath", label="Result",)
|
73 |
+
with gr.Row():
|
74 |
+
btn = gr.Button("Generate")
|
75 |
+
|
76 |
btn.click(virtual_tryon, [src, ref, garment_type], out)
|
77 |
|
78 |
demo.launch(
|
|
|
81 |
pwa=True,
|
82 |
view_api=False
|
83 |
)
|
|