Update app.py
Browse files
app.py
CHANGED
@@ -2,19 +2,22 @@ import numpy as np
|
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
from sklearn.metrics.pairwise import cosine_similarity
|
4 |
from shiny import App, render, ui
|
|
|
5 |
|
6 |
# Initialize the sentence transformer model
|
7 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
8 |
|
9 |
# Sample queries
|
10 |
-
queries = [
|
11 |
-
"What is the weather today?",
|
12 |
-
"How to learn Python?",
|
13 |
-
"Best practices for data science.",
|
14 |
-
"What is the capital of France?",
|
15 |
-
"How to cook pasta?",
|
16 |
# ... (other queries)
|
17 |
-
]
|
|
|
|
|
18 |
|
19 |
# Precompute embeddings for the queries
|
20 |
query_embeddings = model.encode(queries)
|
|
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
from sklearn.metrics.pairwise import cosine_similarity
|
4 |
from shiny import App, render, ui
|
5 |
+
import pandas as pd
|
6 |
|
7 |
# Initialize the sentence transformer model
|
8 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
9 |
|
10 |
# Sample queries
|
11 |
+
#queries = [
|
12 |
+
# "What is the weather today?",
|
13 |
+
# "How to learn Python?",
|
14 |
+
# "Best practices for data science.",
|
15 |
+
# "What is the capital of France?",
|
16 |
+
# "How to cook pasta?",
|
17 |
# ... (other queries)
|
18 |
+
#]
|
19 |
+
|
20 |
+
queries = pd.read_excel("egu_session_descriptions.xlsx").Description
|
21 |
|
22 |
# Precompute embeddings for the queries
|
23 |
query_embeddings = model.encode(queries)
|