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)