File size: 722 Bytes
4610583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

def predict(image):
    # your caption + classification logic here
    return "Generated caption", "Predicted class", 0.95

with gr.Blocks() as demo:
    gr.Markdown("## 🩺 Skin Cancer Web App")
    with gr.Row():
        with gr.Column():
            image_input = gr.Image(type="pil", label="Upload Lesion Image")
            submit_btn = gr.Button("Analyze")
        with gr.Column():
            caption_output = gr.Textbox(label="Generated Caption")
            class_output = gr.Textbox(label="Predicted Class")
            conf_output = gr.Number(label="Confidence Score")

    submit_btn.click(predict, inputs=image_input, outputs=[caption_output, class_output, conf_output])

demo.launch()