daniyal214
commited on
Commit
·
aac2f1c
1
Parent(s):
8ab8ff3
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipe = pipeline("image-to-text", model="daniyal214/finetuned-blip-chest-xrays")
|
5 |
+
|
6 |
+
def get_captions(image_path):
|
7 |
+
result = pipe("/content/PMC2740289_1757-1626-0002-0000006174-002.jpg")
|
8 |
+
result = result[0]['generated_text']
|
9 |
+
return result
|
10 |
+
|
11 |
+
iface = gr.Interface(fn = get_captions, inputs = "image", outputs = ['text'], title="X-rays Image Caption Generator")
|
12 |
+
iface.launch()
|