Asya2025's picture
Create app.py
679183c verified
raw
history blame
657 Bytes
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()