File size: 427 Bytes
aac2f1c |
1 2 3 4 5 6 7 8 9 10 11 12 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("image-to-text", model="daniyal214/finetuned-blip-chest-xrays")
def get_captions(image_path):
result = pipe("/content/PMC2740289_1757-1626-0002-0000006174-002.jpg")
result = result[0]['generated_text']
return result
iface = gr.Interface(fn = get_captions, inputs = "image", outputs = ['text'], title="X-rays Image Caption Generator")
iface.launch() |