Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from transformers import AutoTokenizer,
|
2 |
|
3 |
def load_model_and_tokenizer():
|
4 |
try:
|
@@ -10,7 +10,7 @@ def load_model_and_tokenizer():
|
|
10 |
)
|
11 |
|
12 |
# Load the model with the specific revision
|
13 |
-
model =
|
14 |
'stepfun-ai/GOT-OCR2_0',
|
15 |
revision='cf6b7386bc89a54f09785612ba74cb12de6fa17c', # Pin the specific revision
|
16 |
trust_remote_code=True
|
@@ -28,4 +28,4 @@ if __name__ == "__main__":
|
|
28 |
if model and tokenizer:
|
29 |
print("Model and tokenizer loaded successfully!")
|
30 |
else:
|
31 |
-
print("Failed to load model and tokenizer.")
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModel
|
2 |
|
3 |
def load_model_and_tokenizer():
|
4 |
try:
|
|
|
10 |
)
|
11 |
|
12 |
# Load the model with the specific revision
|
13 |
+
model = AutoModel.from_pretrained(
|
14 |
'stepfun-ai/GOT-OCR2_0',
|
15 |
revision='cf6b7386bc89a54f09785612ba74cb12de6fa17c', # Pin the specific revision
|
16 |
trust_remote_code=True
|
|
|
28 |
if model and tokenizer:
|
29 |
print("Model and tokenizer loaded successfully!")
|
30 |
else:
|
31 |
+
print("Failed to load model and tokenizer.")
|