File size: 836 Bytes
cdc68b4
 
1168346
cdc68b4
 
 
 
5592cc2
cdc68b4
 
 
 
 
 
 
 
 
 
 
 
 
 
238a9c4
cdc68b4
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
import google.generativeai as genai
import gradio as gr
# import PIL.Image

def medicalImageAnalyzer(image,prompt):
    # img = PIL.Image.open(image.name)
    model = genai.GenerativeModel('gemini-1.0-pro-vision-latest')
    response = model.generate_content(["You are medical analyzer, Try to analyse the image and generate a short finding of the image", prompt,image], stream=True)
    response.resolve()
    return response.text

# Define the Gradio interface
iface = gr.Interface(
    fn=medicalImageAnalyzer,
    inputs=[gr.inputs.Image(type="pil", label="Upload a medical image"),
            gr.inputs.Textbox(label="Enter a prompt")],
    outputs="text",
    title="Medical Image Analyzer",
    description="Upload a medical image for analysis."
)

# Launch the interface
iface.launch(debug=False,inline = False,share = False)