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

pipe = pipeline("image-to-text", model="deepseek-ai/DeepSeek-VL2-Small")

def predict(image):
    result = pipe(image)
    return result[0]['generated_text'] if isinstance(result, list) else result

iface = gr.Interface(
    fn=predict,
    inputs=gr.Image(type="pil"),
    outputs="text",
    title="DeepSeek Image-to-Text Generator",
    description="Описание изображений через DeepSeek-VL2-Small"
)

if __name__ == "__main__":
    iface.launch()