Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
-
import safetensors_rust
|
5 |
|
6 |
# Load the trained model and tokenizer
|
7 |
-
model_path = 'viv/AIKIA' #
|
8 |
tokenizer = AutoTokenizer.from_pretrained("nlpaueb/bert-base-greek-uncased-v1")
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
13 |
-
except safetensors_rust.SafetensorError:
|
14 |
-
print("Safetensors failed, trying to load bin file.")
|
15 |
-
model = AutoModelForSequenceClassification.from_pretrained("viv/AIKIA/pytorch_model.bin")
|
16 |
|
17 |
# Preprocessing function for Greek text
|
18 |
def preprocessing_greek(text):
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
|
4 |
|
5 |
# Load the trained model and tokenizer
|
6 |
+
model_path = 'viv/AIKIA/pytorch_model.bin' # Path to the .bin file
|
7 |
tokenizer = AutoTokenizer.from_pretrained("nlpaueb/bert-base-greek-uncased-v1")
|
8 |
|
9 |
+
# Directly load the model from the .bin file
|
10 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path, from_tf=False, config='viv/AIKIA/config.json')
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Preprocessing function for Greek text
|
13 |
def preprocessing_greek(text):
|