Spaces:
Running
Running
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 | |
""" | |
) | |
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() |