Spaces:
Configuration error
Configuration error
File size: 657 Bytes
679183c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|