Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Загружаем модель
|
5 |
pipe = pipeline("image-to-text", model="deepseek-ai/DeepSeek-VL2-Small")
|
6 |
|
7 |
def predict(image):
|
8 |
result = pipe(image)
|
9 |
return result[0]['generated_text'] if isinstance(result, list) else result
|
10 |
|
11 |
-
# Интерфейс для ввода картинки
|
12 |
iface = gr.Interface(
|
13 |
fn=predict,
|
14 |
inputs=gr.Image(type="pil"),
|
15 |
outputs="text",
|
16 |
title="DeepSeek Image-to-Text Generator",
|
17 |
-
description="
|
18 |
)
|
19 |
|
20 |
-
# Запуск
|
21 |
if __name__ == "__main__":
|
22 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
4 |
pipe = pipeline("image-to-text", model="deepseek-ai/DeepSeek-VL2-Small")
|
5 |
|
6 |
def predict(image):
|
7 |
result = pipe(image)
|
8 |
return result[0]['generated_text'] if isinstance(result, list) else result
|
9 |
|
|
|
10 |
iface = gr.Interface(
|
11 |
fn=predict,
|
12 |
inputs=gr.Image(type="pil"),
|
13 |
outputs="text",
|
14 |
title="DeepSeek Image-to-Text Generator",
|
15 |
+
description="Описание изображений через DeepSeek-VL2-Small"
|
16 |
)
|
17 |
|
|
|
18 |
if __name__ == "__main__":
|
19 |
iface.launch()
|