Spaces:
Running
Running
TedYeh
commited on
Commit
·
6d2ffd2
1
Parent(s):
efb05de
update app
Browse files- app.py +10 -9
- predictor.py +1 -1
app.py
CHANGED
|
@@ -12,15 +12,16 @@ with gr.Blocks() as demo:
|
|
| 12 |
### Input A FACE and get the body index
|
| 13 |
"""
|
| 14 |
)
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
#設定按鈕
|
| 26 |
submit = gr.Button("Submit")
|
|
|
|
| 12 |
### Input A FACE and get the body index
|
| 13 |
"""
|
| 14 |
)
|
| 15 |
+
with gr.Row():
|
| 16 |
+
image = gr.Image(type="pil")
|
| 17 |
+
with gr.Column(scale=1, min_width=600):
|
| 18 |
+
# 設定輸出元件
|
| 19 |
+
heights = gr.Textbox(label="Heignt")
|
| 20 |
+
bust = gr.Textbox(label="Bust")
|
| 21 |
+
waist = gr.Textbox(label="Waist")
|
| 22 |
+
hips = gr.Textbox(label="Hips")
|
| 23 |
+
en_des = gr.Textbox(label="English description")
|
| 24 |
+
zh_des = gr.Textbox(label="Chinese description")
|
| 25 |
|
| 26 |
#設定按鈕
|
| 27 |
submit = gr.Button("Submit")
|
predictor.py
CHANGED
|
@@ -224,7 +224,7 @@ def inference(inp_img, classes = ['big', 'small'], epoch = 6):
|
|
| 224 |
idx = preds.numpy()[0]
|
| 225 |
|
| 226 |
# unconditional image captioning
|
| 227 |
-
inputs = processor(inp_img, return_tensors="pt")
|
| 228 |
out = model_blip.generate(**inputs)
|
| 229 |
description = processor.decode(out[0], skip_special_tokens=True)
|
| 230 |
description_tw = translator.translate(description)
|
|
|
|
| 224 |
idx = preds.numpy()[0]
|
| 225 |
|
| 226 |
# unconditional image captioning
|
| 227 |
+
inputs = processor(inp_img, return_tensors="pt").to(device)
|
| 228 |
out = model_blip.generate(**inputs)
|
| 229 |
description = processor.decode(out[0], skip_special_tokens=True)
|
| 230 |
description_tw = translator.translate(description)
|