Spaces:
Runtime error
Runtime error
File size: 2,608 Bytes
4a8e930 42fa7ec ec42e29 42fa7ec 14e27af 4a8e930 14e27af c02063c ec42e29 2428a43 ec42e29 14e27af ec42e29 ac9f0e8 f46e4a1 14e27af ec42e29 14e27af c02063c 2428a43 c02063c 2428a43 c02063c 2428a43 c02063c 2428a43 c02063c 2428a43 c02063c 2428a43 14e27af 42fa7ec a8f168f |
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import os
import pip
import gradio as gr
from PIL import Image
from backend import Infer
DEBUG = False
infer = Infer(DEBUG)
example_image_path = ["assets/example_1.jpg", "assets/example_2.jpg", "assets/example_3.jpg"]
outputs = [
gr.Image(label="Thumb"),
gr.Number(label="DeepNAPSI Thumb", precision=0),
gr.Image(label="Index"),
gr.Number(label="DeepNAPSI Index", precision=0),
gr.Image(label="Middle"),
gr.Number(label="DeepNAPSI Middle", precision=0),
gr.Image(label="Ring"),
gr.Number(label="DeepNAPSI Ring", precision=0),
gr.Image(label="Pinky"),
gr.Number(label="DeepNAPSI Pinky", precision=0),
gr.Number(label="DeepNAPSI Sum", precision=0),
]
with gr.Blocks(analytics_enabled=False, title="DeepNAPSI") as demo:
with gr.Column():
gr.Markdown("## Welcome to the DeepNAPSI application!")
gr.Markdown("Upload an image of the one hand and click **Predict NAPSI** to see the output.")
gr.Markdown("*Note*: Make sure there are no identifying information present in the image. The prediction can take up to 1 minute." )
gr.Markdown("*Note*: This is not a medical product and cannot be used for a patient diagnosis in any way.")
with gr.Column():
with gr.Row():
with gr.Column():
with gr.Row():
image_input = gr.Image()
example_images = gr.Examples(example_image_path, image_input, outputs,
fn=infer.predict, cache_examples=True)
with gr.Row():
image_button = gr.Button("Predict NAPSI")
with gr.Row():
with gr.Column():
outputs[0].render()
outputs[1].render()
with gr.Column():
outputs[2].render()
outputs[3].render()
with gr.Column():
outputs[4].render()
outputs[5].render()
with gr.Column():
outputs[6].render()
outputs[7].render()
with gr.Column():
outputs[8].render()
outputs[9].render()
outputs[10].render()
image_button.click(infer.predict, inputs=image_input, outputs=outputs)
demo.launch(share=True if DEBUG else False, enable_queue=True, favicon_path="assets/favicon-32x32.png")
|