Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ CSV dosyalarını yükleyip canlı çalıştırabilir.
|
|
| 8 |
python app.py
|
| 9 |
"""
|
| 10 |
|
|
|
|
| 11 |
from importlib import resources
|
| 12 |
|
| 13 |
# ZeroGPU donanımında çalışırken bu import torch'tan ÖNCE gelmeli.
|
|
@@ -38,11 +39,41 @@ def paket_dosyasi(ad):
|
|
| 38 |
return resources.files("embedpick") / "sample_data" / ad
|
| 39 |
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
def hazir_sonuclar():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
try:
|
| 43 |
return pd.read_csv(paket_dosyasi("precomputed_results.csv"))
|
| 44 |
except Exception:
|
| 45 |
-
return
|
| 46 |
|
| 47 |
|
| 48 |
GIRIS = f"""
|
|
|
|
| 8 |
python app.py
|
| 9 |
"""
|
| 10 |
|
| 11 |
+
import pathlib
|
| 12 |
from importlib import resources
|
| 13 |
|
| 14 |
# ZeroGPU donanımında çalışırken bu import torch'tan ÖNCE gelmeli.
|
|
|
|
| 39 |
return resources.files("embedpick") / "sample_data" / ad
|
| 40 |
|
| 41 |
|
| 42 |
+
# Yayınlanmış paket sürümü bu dosyayı içermeyebilir, o yüzden gömülü bir
|
| 43 |
+
# yedek tutuyoruz. Sayılar 72 doküman / 26 sorgu ile tek bir makinede,
|
| 44 |
+
# yalnızca işlemci üzerinde ölçüldü.
|
| 45 |
+
YEDEK_SONUCLAR = pd.DataFrame(
|
| 46 |
+
[
|
| 47 |
+
["BM25 (baseline)", 0.564, 0.564, 226486.3, 0, 0.00, "-"],
|
| 48 |
+
["paraphrase-multilingual-MiniLM-L12-v2", 0.615, 0.596, 340.4, 384, 0.11, "1.00x"],
|
| 49 |
+
["multilingual-e5-small", 0.692, 0.708, 304.1, 384, 0.11, "0.89x"],
|
| 50 |
+
["turkish-embedding-model", 0.846, 0.865, 103.0, 768, 0.21, "0.30x"],
|
| 51 |
+
],
|
| 52 |
+
columns=[
|
| 53 |
+
"model",
|
| 54 |
+
"recall@5",
|
| 55 |
+
"mrr@5",
|
| 56 |
+
"docs_per_sec",
|
| 57 |
+
"dim",
|
| 58 |
+
"index_mb",
|
| 59 |
+
"rel_speed",
|
| 60 |
+
],
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
def hazir_sonuclar():
|
| 65 |
+
"""Önce app.py'nin yanındaki dosyaya, sonra pakete, sonra gömülü yedeğe bakar."""
|
| 66 |
+
yerel = pathlib.Path(__file__).parent / "precomputed_results.csv"
|
| 67 |
+
if yerel.exists():
|
| 68 |
+
try:
|
| 69 |
+
return pd.read_csv(yerel)
|
| 70 |
+
except Exception:
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
try:
|
| 74 |
return pd.read_csv(paket_dosyasi("precomputed_results.csv"))
|
| 75 |
except Exception:
|
| 76 |
+
return YEDEK_SONUCLAR
|
| 77 |
|
| 78 |
|
| 79 |
GIRIS = f"""
|