Spaces:
Sleeping
Sleeping
Update output format
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def search_query(query, top_k=10):
|
|
20 |
|
21 |
id_list = ", ".join(map(str, similar_item_ids))
|
22 |
sql_query = f"""
|
23 |
-
SELECT w.value AS
|
24 |
FROM definitions d
|
25 |
JOIN words w ON d.word_id = w.word_id
|
26 |
WHERE d.entry_id IN ({id_list})
|
@@ -30,13 +30,12 @@ def search_query(query, top_k=10):
|
|
30 |
"""
|
31 |
|
32 |
results = conn.execute(sql_query).fetchdf()
|
33 |
-
|
34 |
-
results["relevance_score"] = [1 - d for d in distances]
|
35 |
|
36 |
return results
|
37 |
|
38 |
|
39 |
-
# Example queries in natural language
|
40 |
examples = [
|
41 |
"väga vana mees",
|
42 |
"очень старый дед",
|
|
|
20 |
|
21 |
id_list = ", ".join(map(str, similar_item_ids))
|
22 |
sql_query = f"""
|
23 |
+
SELECT w.value AS sõna, d.value AS definitsioon
|
24 |
FROM definitions d
|
25 |
JOIN words w ON d.word_id = w.word_id
|
26 |
WHERE d.entry_id IN ({id_list})
|
|
|
30 |
"""
|
31 |
|
32 |
results = conn.execute(sql_query).fetchdf()
|
33 |
+
results["#"] = list(range(1, len(results) + 1))
|
34 |
+
# results["relevance_score"] = [1 - d for d in distances]
|
35 |
|
36 |
return results
|
37 |
|
38 |
|
|
|
39 |
examples = [
|
40 |
"väga vana mees",
|
41 |
"очень старый дед",
|