edersonmelo commited on
Commit
8f7acb2
·
1 Parent(s): 51c876c

Add application file

Browse files
Files changed (2) hide show
  1. app.py +20 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Exemplo com BLIP-2
5
+ MODEL = "Salesforce/blip2-flan-t5-xl"
6
+
7
+ pipe = pipeline("image-to-text", model=MODEL)
8
+
9
+ def describe_image(image):
10
+ result = pipe(image)
11
+ return result[0]["generated_text"]
12
+
13
+ iface = gr.Interface(
14
+ fn=describe_image,
15
+ inputs=gr.Image(type="pil"),
16
+ outputs="text",
17
+ title="Teste - Visão Computacional"
18
+ )
19
+
20
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio