Update app.py
Browse files
app.py
CHANGED
|
@@ -72,11 +72,13 @@ class TextClassifier:
|
|
| 72 |
"""Initialize the model and tokenizer."""
|
| 73 |
logger.info("Initializing model and tokenizer...")
|
| 74 |
|
| 75 |
-
#
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
|
| 81 |
# First initialize the base model
|
| 82 |
self.model = AutoModelForSequenceClassification.from_pretrained(
|
|
|
|
| 72 |
"""Initialize the model and tokenizer."""
|
| 73 |
logger.info("Initializing model and tokenizer...")
|
| 74 |
|
| 75 |
+
# Download and save tokenizer files locally
|
| 76 |
+
local_tokenizer_path = "tokenizer"
|
| 77 |
+
if not os.path.exists(local_tokenizer_path):
|
| 78 |
+
AutoTokenizer.from_pretrained(self.model_name).save_pretrained(local_tokenizer_path)
|
| 79 |
+
|
| 80 |
+
# Load from local files
|
| 81 |
+
self.tokenizer = AutoTokenizer.from_pretrained(local_tokenizer_path)
|
| 82 |
|
| 83 |
# First initialize the base model
|
| 84 |
self.model = AutoModelForSequenceClassification.from_pretrained(
|