Spaces:
Running
Running
import gradio as gr | |
from predictor import inference | |
def index_predict(name): | |
outputs, preds, heights, bust, waist, hips, description = inference(os.path.join(app.config['UPLOAD_FOLDER'], filename), 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") | |
# 設定輸出元件 | |
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") | |
#設定按鈕點選事件 | |
greet_btn.click(fn=index_predict, inputs=image, outputs=[heights, bust, waist, hips, en_des, zh_des]) | |
demo.launch() |