Spaces:
Running
Running
File size: 1,082 Bytes
8a7491d e774cd9 8a7491d f680b9e e774cd9 8a7491d e774cd9 6d2ffd2 e774cd9 a10bcbf e774cd9 |
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 |
import gradio as gr
from predictor import inference
def index_predict(img):
outputs, preds, heights, bust, waist, hips, description = inference(img, epoch = 7)
return heights, round(float(bust)), round(float(waist)), round(float(hips)), description[0], description[1]
with gr.Blocks() as demo:
gr.Markdown(
"""
# 身材數據評估器 - Body Index Predictor
### Input A FACE and get the body index
"""
)
with gr.Row():
image = gr.Image(type="pil")
with gr.Column(scale=1, min_width=600):
# 設定輸出元件
heights = gr.Textbox(label="Heignt")
bust = gr.Textbox(label="Bust")
waist = gr.Textbox(label="Waist")
hips = gr.Textbox(label="Hips")
en_des = gr.Textbox(label="English description")
zh_des = gr.Textbox(label="Chinese description")
#設定按鈕
submit = gr.Button("Submit")
#設定按鈕點選事件
submit.click(fn=index_predict, inputs=image, outputs=[heights, bust, waist, hips, en_des, zh_des])
demo.launch() |