preston-cell commited on
Commit
7c350ea
·
verified ·
1 Parent(s): 0fba986

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -1,16 +1,11 @@
1
  import gradio as gr
2
- from transformers import AutoTokenizer, AutoModelForImageTextToText
3
- import torch
4
 
5
- tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolVLM2-2.2B-Instruct")
6
- model = AutoModelForImageTextToText.from_pretrained("HuggingFaceTB/SmolVLM2-2.2B-Instruct")
7
-
8
- model_path = "HuggingFaceTB/SmolVLM2-2.2B-Instruct"
9
- processor = AutoProcessor.from_pretrained(model_path)
10
 
11
  def launch(input):
12
- out = model.generate(**input)
13
- return(out)
14
 
15
  iface = gr.Interface(launch,
16
  inputs=gr.Image(type='pil'),
 
1
  import gradio as gr
2
+ from transformers import pipeline
 
3
 
4
+ pipe = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
 
 
 
 
5
 
6
  def launch(input):
7
+ out = pipe(input)
8
+ return out[0]['generated_text']
9
 
10
  iface = gr.Interface(launch,
11
  inputs=gr.Image(type='pil'),