Spaces:
Sleeping
Sleeping
File size: 1,342 Bytes
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(["As a medical analyzer, your task is to thoroughly examine the image and provide a comprehensive analysis. Here's a refined version of your prompt: You are a medical analyst tasked with analyzing the provided image. Your goal is to provide a detailed analysis based on the input image and describe both the dos and don'ts associated with it. Please proceed with your analysis. This prompt conveys a clear and concise instruction for the medical analyzer, outlining their role and the objective of the analysis. It prompts them to provide both detailed insights into the image and practical recommendations based on their findings.", 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)
|