File size: 585 Bytes
0483ead
0fba986
40c03fb
0483ead
0fba986
 
 
40c03fb
 
0483ead
 
40c03fb
 
0483ead
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import AutoTokenizer, AutoModelForImageTextToText
import torch

tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolVLM2-2.2B-Instruct")
model = AutoModelForImageTextToText.from_pretrained("HuggingFaceTB/SmolVLM2-2.2B-Instruct")

model_path = "HuggingFaceTB/SmolVLM2-2.2B-Instruct"
processor = AutoProcessor.from_pretrained(model_path)

def launch(input):
    out = model.generate(**input)
    return(out)

iface = gr.Interface(launch,
                     inputs=gr.Image(type='pil'),
                     outputs="text")

iface.launch()