Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,8 @@ import torch
|
|
21 |
from huggingface_hub import InferenceClient
|
22 |
from transformers import AutoTokenizer
|
23 |
from transformers import AutoImageProcessor
|
|
|
|
|
24 |
import spaces
|
25 |
IS_SPACES_ZERO = os.environ.get("SPACES_ZERO_GPU", "0") == "1"
|
26 |
IS_SPACE = os.environ.get("SPACE_ID", None) is not None
|
@@ -49,9 +51,7 @@ image_processor = AutoImageProcessor.from_pretrained(MODEL_ID)
|
|
49 |
# Load models only once
|
50 |
processor = AutoProcessor.from_pretrained(MODEL_ID)
|
51 |
model = LlavaForConditionalGeneration.from_pretrained(MODEL_ID, quantization_config=quantization_config, device_map="auto")
|
52 |
-
# Pass the tokenizer explicitly to the pipeline
|
53 |
-
# Pass the image processor explicitly to the pipeline
|
54 |
-
#pipe_image_to_text = pipeline("image-to-text", model=model, tokenizer=tokenizer_image_to_text, image_processor=image_processor, model_kwargs={"quantization_config": quantization_config})
|
55 |
# Initialize the text generation pipeline
|
56 |
|
57 |
pipe_text = pipeline(
|
|
|
21 |
from huggingface_hub import InferenceClient
|
22 |
from transformers import AutoTokenizer
|
23 |
from transformers import AutoImageProcessor
|
24 |
+
from datasets import load_dataset
|
25 |
+
import pyarrow
|
26 |
import spaces
|
27 |
IS_SPACES_ZERO = os.environ.get("SPACES_ZERO_GPU", "0") == "1"
|
28 |
IS_SPACE = os.environ.get("SPACE_ID", None) is not None
|
|
|
51 |
# Load models only once
|
52 |
processor = AutoProcessor.from_pretrained(MODEL_ID)
|
53 |
model = LlavaForConditionalGeneration.from_pretrained(MODEL_ID, quantization_config=quantization_config, device_map="auto")
|
54 |
+
# Pass the tokenizer, image processor explicitly to the pipeline
|
|
|
|
|
55 |
# Initialize the text generation pipeline
|
56 |
|
57 |
pipe_text = pipeline(
|