Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -7,13 +7,13 @@ import tensorflow as tf
|
|
7 |
MODEL_NAME = "Erfan11/Neuracraft"
|
8 |
API_KEY = "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"
|
9 |
|
10 |
-
def load_model(
|
11 |
# Load the TensorFlow model from Hugging Face Hub
|
12 |
-
model = TFBertForSequenceClassification.from_pretrained(model_name, use_auth_token=
|
13 |
return model
|
14 |
|
15 |
-
def load_tokenizer(
|
16 |
-
tokenizer = BertTokenizerFast.from_pretrained(model_name, use_auth_token=
|
17 |
return tokenizer
|
18 |
|
19 |
def predict(text, model, tokenizer):
|
@@ -22,8 +22,8 @@ def predict(text, model, tokenizer):
|
|
22 |
return outputs
|
23 |
|
24 |
def main():
|
25 |
-
model_name =
|
26 |
-
model = load_model(
|
27 |
tokenizer = load_tokenizer(model_name)
|
28 |
# Example usage
|
29 |
text = "Sample input text"
|
|
|
7 |
MODEL_NAME = "Erfan11/Neuracraft"
|
8 |
API_KEY = "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"
|
9 |
|
10 |
+
def load_model(Erfan11/Neuracraft):
|
11 |
# Load the TensorFlow model from Hugging Face Hub
|
12 |
+
model = TFBertForSequenceClassification.from_pretrained(model_name, use_auth_token=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)
|
13 |
return model
|
14 |
|
15 |
+
def load_tokenizer(Erfan11/Neuracraft):
|
16 |
+
tokenizer = BertTokenizerFast.from_pretrained(model_name, use_auth_token=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)
|
17 |
return tokenizer
|
18 |
|
19 |
def predict(text, model, tokenizer):
|
|
|
22 |
return outputs
|
23 |
|
24 |
def main():
|
25 |
+
model_name = Erfan11/Neuracraft
|
26 |
+
model = load_model(Erfan11/Neuracraft)
|
27 |
tokenizer = load_tokenizer(model_name)
|
28 |
# Example usage
|
29 |
text = "Sample input text"
|