File size: 868 Bytes
0e28ea3 2c597e4 0e28ea3 2c597e4 0e28ea3 3300af1 0e28ea3 3300af1 0e28ea3 3300af1 0e28ea3 8904ecb 0e28ea3 3300af1 0d1f427 |
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 31 32 33 34 35 |
import gradio as gr
from predict import ONNXInference
PRED = []
def detect(files):
model = ONNXInference(
model_path="./torchFlow-ckpt.onnx",
files=files,
save_image=False,
save_path="./"
)
res = model.run()
img_id = res["IMG_ID"]
pred_lab = res["PRED_LAB"],
pred_ct = res["PRED_CT"],
geo_tag_url = res["GEO_TAG_URL"]
PRED.append(pred_ct)
print(res["PRED_CT"])
return res["PRED_CT"]
with gr.Blocks() as demo:
gr.Markdown("# DetectIt")
with gr.Row():
image = gr.UploadButton(
label="Upload Image",
file_types=[".jpg",".jpeg"],
file_count="multiple")
btn = gr.Button("Go")
text = gr.Textbox(show_label=False, elem_id="result-textarea")
btn.click(detect, inputs=[image], outputs=[text], api_name="predict")
demo.launch() |