Spaces:
Sleeping
Sleeping
Himanshu-AT
commited on
Commit
·
dc1bb11
1
Parent(s):
d589c4e
resolve build errors
Browse files- app.py +10 -4
- requirements.txt +1 -1
app.py
CHANGED
@@ -11,6 +11,8 @@ import spaces
|
|
11 |
|
12 |
import gradio as gr
|
13 |
|
|
|
|
|
14 |
# Download checkpoints
|
15 |
snapshot_download(repo_id="franciszzj/Leffa", local_dir="./ckpts")
|
16 |
|
@@ -36,6 +38,8 @@ pt_model = LeffaModel(
|
|
36 |
)
|
37 |
pt_inference = LeffaInference(model=pt_model)
|
38 |
|
|
|
|
|
39 |
@spaces.GPU
|
40 |
def leffa_predict(src_image_path, ref_image_path, control_type):
|
41 |
assert control_type in [
|
@@ -89,10 +93,12 @@ def leffa_predict_vt(src_image_path, ref_image_path):
|
|
89 |
return leffa_predict(src_image_path, ref_image_path, "virtual_tryon")
|
90 |
|
91 |
@spaces.GPU
|
92 |
-
def leffa_predict_vt_image_url(
|
93 |
-
|
|
|
|
|
94 |
print("fetched person image")
|
95 |
-
ref_image = fetch_image_from_url(
|
96 |
print("fetched garment image")
|
97 |
|
98 |
return leffa_predict(src_image, ref_image, "virtual_tryon")
|
@@ -289,7 +295,7 @@ def create_demo():
|
|
289 |
)
|
290 |
|
291 |
generate_btn.click(
|
292 |
-
fn=
|
293 |
inputs=[person_url, garment_url],
|
294 |
outputs=output_image
|
295 |
)
|
|
|
11 |
|
12 |
import gradio as gr
|
13 |
|
14 |
+
print("Imports done, downloading the model...")
|
15 |
+
|
16 |
# Download checkpoints
|
17 |
snapshot_download(repo_id="franciszzj/Leffa", local_dir="./ckpts")
|
18 |
|
|
|
38 |
)
|
39 |
pt_inference = LeffaInference(model=pt_model)
|
40 |
|
41 |
+
print("Model downloaded, ready to serve!")
|
42 |
+
|
43 |
@spaces.GPU
|
44 |
def leffa_predict(src_image_path, ref_image_path, control_type):
|
45 |
assert control_type in [
|
|
|
93 |
return leffa_predict(src_image_path, ref_image_path, "virtual_tryon")
|
94 |
|
95 |
@spaces.GPU
|
96 |
+
def leffa_predict_vt_image_url(person_url, garment_url):
|
97 |
+
if not person_url or not garment_url:
|
98 |
+
return None
|
99 |
+
src_image = fetch_image_from_url(person_url)
|
100 |
print("fetched person image")
|
101 |
+
ref_image = fetch_image_from_url(garment_url)
|
102 |
print("fetched garment image")
|
103 |
|
104 |
return leffa_predict(src_image, ref_image, "virtual_tryon")
|
|
|
295 |
)
|
296 |
|
297 |
generate_btn.click(
|
298 |
+
fn=leffa_predict_vt_image_url,
|
299 |
inputs=[person_url, garment_url],
|
300 |
outputs=output_image
|
301 |
)
|
requirements.txt
CHANGED
@@ -29,4 +29,4 @@ torchvision
|
|
29 |
tqdm
|
30 |
transformers
|
31 |
triton
|
32 |
-
cloudpickle
|
|
|
29 |
tqdm
|
30 |
transformers
|
31 |
triton
|
32 |
+
cloudpickle
|