Update handler.py
Browse files- handler.py +3 -4
handler.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from typing import Dict, List, Any
|
2 |
import torch
|
3 |
-
from transformers import
|
4 |
from PIL import Image
|
5 |
import requests
|
6 |
from io import BytesIO
|
@@ -16,8 +16,8 @@ class EndpointHandler():
|
|
16 |
)
|
17 |
|
18 |
# Carrega el processador i model de forma global
|
19 |
-
self.processor =
|
20 |
-
self.model =
|
21 |
"llava-hf/llava-v1.6-mistral-7b-hf",
|
22 |
quantization_config=quantization_config,
|
23 |
device_map="auto"
|
@@ -60,4 +60,3 @@ class EndpointHandler():
|
|
60 |
score = int(match[2])
|
61 |
scores[category_name] = score
|
62 |
return scores
|
63 |
-
|
|
|
1 |
from typing import Dict, List, Any
|
2 |
import torch
|
3 |
+
from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration, BitsAndBytesConfig
|
4 |
from PIL import Image
|
5 |
import requests
|
6 |
from io import BytesIO
|
|
|
16 |
)
|
17 |
|
18 |
# Carrega el processador i model de forma global
|
19 |
+
self.processor = LlavaNextProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
|
20 |
+
self.model = LlavaNextForConditionalGeneration.from_pretrained(
|
21 |
"llava-hf/llava-v1.6-mistral-7b-hf",
|
22 |
quantization_config=quantization_config,
|
23 |
device_map="auto"
|
|
|
60 |
score = int(match[2])
|
61 |
scores[category_name] = score
|
62 |
return scores
|
|