File size: 411 Bytes
8f7acb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from transformers import pipeline

# Exemplo com BLIP-2
MODEL = "Salesforce/blip2-flan-t5-xl"

pipe = pipeline("image-to-text", model=MODEL)

def describe_image(image):
    result = pipe(image)
    return result[0]["generated_text"]

iface = gr.Interface(
    fn=describe_image,
    inputs=gr.Image(type="pil"),
    outputs="text",
    title="Teste - Visão Computacional"
)

iface.launch()