Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,9 @@ import torch
|
|
3 |
from transformers import AutoFeatureExtractor, AutoTokenizer, VisionEncoderDecoderModel, GPT2Tokenizer, pipeline
|
4 |
import os
|
5 |
|
|
|
|
|
|
|
6 |
device = 'cpu'
|
7 |
auth_token = os.getenv("auth_token")
|
8 |
#auth_token = os.environ.get("auth_token")
|
@@ -67,7 +70,7 @@ def predict_step_pixel(dataset_pixel_values, model):
|
|
67 |
image methods
|
68 |
"""
|
69 |
def load_image2txt_model(image_model_name):
|
70 |
-
model = VisionEncoderDecoderModel.from_pretrained(image_model_name
|
71 |
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/swin-large-patch4-window7-224", use_auth_token=auth_token)
|
72 |
|
73 |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2", use_auth_token=auth_token)
|
|
|
3 |
from transformers import AutoFeatureExtractor, AutoTokenizer, VisionEncoderDecoderModel, GPT2Tokenizer, pipeline
|
4 |
import os
|
5 |
|
6 |
+
HF_DATASETS_OFFLINE=1
|
7 |
+
TRANSFORMERS_OFFLINE=1
|
8 |
+
|
9 |
device = 'cpu'
|
10 |
auth_token = os.getenv("auth_token")
|
11 |
#auth_token = os.environ.get("auth_token")
|
|
|
70 |
image methods
|
71 |
"""
|
72 |
def load_image2txt_model(image_model_name):
|
73 |
+
model = VisionEncoderDecoderModel.from_pretrained(image_model_name)
|
74 |
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/swin-large-patch4-window7-224", use_auth_token=auth_token)
|
75 |
|
76 |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2", use_auth_token=auth_token)
|