Spaces:
Sleeping
Sleeping
fix: move hf token to repo envs
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ def load_model(pretrained_revision: str = 'main'):
|
|
23 |
if processor is None or loaded_revision is None or loaded_revision != pretrained_revision:
|
24 |
loaded_revision=pretrained_revision
|
25 |
processor = DonutProcessor.from_pretrained(
|
26 |
-
pretrained_repo_name, revision=pretrained_revision, use_auth_token="
|
27 |
processor.image_processor.do_align_long_axis = False
|
28 |
# do not manipulate image size and position
|
29 |
processor.image_processor.do_resize = False
|
@@ -33,7 +33,7 @@ def load_model(pretrained_revision: str = 'main'):
|
|
33 |
processor.image_processor.do_normalize = True
|
34 |
print(f'processor image size: {processor.image_processor.size}')
|
35 |
model = VisionEncoderDecoderModel.from_pretrained(
|
36 |
-
pretrained_repo_name, use_auth_token="
|
37 |
print(f'model checkpoint loaded')
|
38 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
39 |
model.to(device)
|
|
|
23 |
if processor is None or loaded_revision is None or loaded_revision != pretrained_revision:
|
24 |
loaded_revision=pretrained_revision
|
25 |
processor = DonutProcessor.from_pretrained(
|
26 |
+
pretrained_repo_name, revision=pretrained_revision) # , use_auth_token="...")
|
27 |
processor.image_processor.do_align_long_axis = False
|
28 |
# do not manipulate image size and position
|
29 |
processor.image_processor.do_resize = False
|
|
|
33 |
processor.image_processor.do_normalize = True
|
34 |
print(f'processor image size: {processor.image_processor.size}')
|
35 |
model = VisionEncoderDecoderModel.from_pretrained(
|
36 |
+
pretrained_repo_name, revision=pretrained_revision) # use_auth_token="...",
|
37 |
print(f'model checkpoint loaded')
|
38 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
39 |
model.to(device)
|