daniyal214's picture
Create app.py
aac2f1c
raw
history blame
427 Bytes
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()