Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ from PIL import Image
|
|
5 |
from transformers import AutoModel, AutoTokenizer
|
6 |
import spaces
|
7 |
|
8 |
-
device
|
9 |
|
10 |
# Load the model and tokenizer
|
11 |
model = AutoModel.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5', trust_remote_code=True, torch_dtype=torch.float16)
|
12 |
-
model = model.to(device=
|
13 |
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5', trust_remote_code=True)
|
14 |
model.eval()
|
15 |
|
@@ -51,5 +51,5 @@ with gr.Blocks(theme='abidlabs/dracula_revamped') as demo:
|
|
51 |
image_input.change(generate_response, inputs=[image_input, question_input], outputs=output_text)
|
52 |
gr.HTML(footer)
|
53 |
|
54 |
-
# Launch the app
|
55 |
-
|
|
|
5 |
from transformers import AutoModel, AutoTokenizer
|
6 |
import spaces
|
7 |
|
8 |
+
device="cuda"
|
9 |
|
10 |
# Load the model and tokenizer
|
11 |
model = AutoModel.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5', trust_remote_code=True, torch_dtype=torch.float16)
|
12 |
+
model = model.to(device='cuda')
|
13 |
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5', trust_remote_code=True)
|
14 |
model.eval()
|
15 |
|
|
|
51 |
image_input.change(generate_response, inputs=[image_input, question_input], outputs=output_text)
|
52 |
gr.HTML(footer)
|
53 |
|
54 |
+
# Launch the app
|
55 |
+
demo.launch(debug=True)
|