Deploy DeepSeek-VL QA app
Browse files- app.py +20 -4
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from deepseek_vl import DeepSeekVL
|
3 |
|
4 |
+
# Initialize DeepSeek-VL model (CPU for free Spaces)
|
5 |
+
model = DeepSeekVL(model_path="deepseek-ai/deepseek-vl-7b", device="cpu")
|
6 |
|
7 |
+
def qa(image, question):
|
8 |
+
# Run DeepSeek-VL inference: image + question -> answer
|
9 |
+
return model.generate(image, question)
|
10 |
+
|
11 |
+
demo = gr.Interface(
|
12 |
+
fn=qa,
|
13 |
+
inputs=[
|
14 |
+
gr.Image(type="pil", label="Upload Image"),
|
15 |
+
gr.Textbox(label="Enter your question")
|
16 |
+
],
|
17 |
+
outputs="text",
|
18 |
+
title="DeepSeek-VL Multimodal QA Demo",
|
19 |
+
description="Upload an image and enter a question. Experience DeepSeek-VL's vision-language capabilities."
|
20 |
+
)
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
+
demo.launch()
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
gradio
|
2 |
deepseek-vl
|
|
|
3 |
torch
|
4 |
transformers
|
|
|
|
|
1 |
deepseek-vl
|
2 |
+
gradio
|
3 |
torch
|
4 |
transformers
|