Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,28 @@ model_names = ["distilbert-base-uncased", "prajjwal1/bert-tiny", "roberta-base",
|
|
| 13 |
models = {}
|
| 14 |
tokenizers = {}
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
for model_name in model_names:
|
| 17 |
# Tokenizators
|
| 18 |
tokenizers[model_name] = AutoTokenizer.from_pretrained(model_name, max_length=512)
|
|
|
|
| 13 |
models = {}
|
| 14 |
tokenizers = {}
|
| 15 |
|
| 16 |
+
# === Modelis → URL ===
|
| 17 |
+
model_urls = {
|
| 18 |
+
"best_model_albert-base-v2.pth": "https://www.dropbox.com/scl/fi/adulme5xarg6hgxbs26fm/best_model_albert-base-v2.pth?rlkey=y17x3sw1frk83yfzt8zc00458&st=43uha18d&dl=1",
|
| 19 |
+
"best_model_distilbert-base-uncased.pth": "https://www.dropbox.com/scl/fi/8y3oyfbzmbmn427e1ei3d/best_model_distilbert-base-uncased.pth?rlkey=u9rd40tdd3p781r4xtv8wi5t6&st=nfzq7x8j&dl=1",
|
| 20 |
+
"best_model_google_mobilebert-uncased.pth": "https://www.dropbox.com/scl/fi/7zdarid2no1fw0b8hk0tf/best_model_google_mobilebert-uncased.pth?rlkey=w13j1jampxlt8himivj090nwv&st=0zq6yofp&dl=1",
|
| 21 |
+
"best_model_prajjwal1_bert-tiny.pth": "https://www.dropbox.com/scl/fi/vscwewy4uo58o7xswokxt/best_model_prajjwal1_bert-tiny.pth?rlkey=uav8aas7fxb5nl2w5iacg1qyb&st=12mzggan&dl=1",
|
| 22 |
+
"best_model_roberta-base.pth": "https://www.dropbox.com/scl/fi/6rlgceyp3azbvd803efa7/best_model_roberta-base.pth?rlkey=xojr8akv2mmvjpkztrv7gg01a&st=h4g5jjf4&dl=1",
|
| 23 |
+
"best_model_xlm-roberta-base.pth": "https://www.dropbox.com/scl/fi/2gao9iqesou9kb633vvan/best_model_xlm-roberta-base.pth?rlkey=acyvwt8qtle8wzle5idfo8241&st=8livizox&dl=1",
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# === Lejupielādē modeļus, ja nav ===
|
| 28 |
+
for filename, url in model_urls.items():
|
| 29 |
+
if not os.path.exists(filename):
|
| 30 |
+
print(f"Lejupielādē: {filename}")
|
| 31 |
+
try:
|
| 32 |
+
urllib.request.urlretrieve(url, filename)
|
| 33 |
+
print(f" → Saglabāts: {filename}")
|
| 34 |
+
except Exception as e:
|
| 35 |
+
print(f" [!] Kļūda lejupielādējot {filename}: {e}")
|
| 36 |
+
|
| 37 |
+
|
| 38 |
for model_name in model_names:
|
| 39 |
# Tokenizators
|
| 40 |
tokenizers[model_name] = AutoTokenizer.from_pretrained(model_name, max_length=512)
|