Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,12 @@ import gradio as gr
|
|
| 11 |
|
| 12 |
# DEVICE = config.device
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
model = AutoModel.from_pretrained("thak123/bert-emoji-latvian-twitter-classifier")
|
| 15 |
# 7 EPOCH Version
|
| 16 |
BERT_PATH = "FFZG-cleopatra/bert-emoji-latvian-twitter"
|
|
@@ -72,12 +78,12 @@ def sentence_prediction(sentence):
|
|
| 72 |
|
| 73 |
# device = config.device
|
| 74 |
|
| 75 |
-
|
| 76 |
-
#
|
| 77 |
-
#
|
| 78 |
-
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
outputs = classifier(sentence)
|
| 83 |
|
|
|
|
| 11 |
|
| 12 |
# DEVICE = config.device
|
| 13 |
|
| 14 |
+
import requests
|
| 15 |
+
URL = "https://huggingface.co/FFZG-cleopatra/bert-emoji-latvian-twitter/blob/main/pytorch_model.bin"
|
| 16 |
+
response = requests.get(URL)
|
| 17 |
+
open("pytorch_model.bin", "wb").write(response.content)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
model = AutoModel.from_pretrained("thak123/bert-emoji-latvian-twitter-classifier")
|
| 21 |
# 7 EPOCH Version
|
| 22 |
BERT_PATH = "FFZG-cleopatra/bert-emoji-latvian-twitter"
|
|
|
|
| 78 |
|
| 79 |
# device = config.device
|
| 80 |
|
| 81 |
+
model = BERTBaseUncased()
|
| 82 |
+
# model.load_state_dict(torch.load(
|
| 83 |
+
# model_path, map_location=torch.device(device)))
|
| 84 |
+
model.to(device)
|
| 85 |
|
| 86 |
+
outputs, [] = engine.predict_fn(test_data_loader, MODEL, device)
|
| 87 |
|
| 88 |
outputs = classifier(sentence)
|
| 89 |
|