Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,12 @@ import spaces
|
|
9 |
data = pd.read_csv('RBDx10stats.csv')
|
10 |
|
11 |
# Convert embedding column from string to numpy array
|
12 |
-
data['
|
13 |
|
14 |
# Initialize FAISS index
|
15 |
-
dimension = len(data['
|
16 |
index = faiss.IndexFlatL2(dimension)
|
17 |
-
index.add(np.stack(data['
|
18 |
|
19 |
# Load QA model
|
20 |
qa_model = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
|
|
|
9 |
data = pd.read_csv('RBDx10stats.csv')
|
10 |
|
11 |
# Convert embedding column from string to numpy array
|
12 |
+
data['embedding'] = data['embedding'].apply(lambda x: np.fromstring(x[1:-1], sep=', '))
|
13 |
|
14 |
# Initialize FAISS index
|
15 |
+
dimension = len(data['embedding'][0])
|
16 |
index = faiss.IndexFlatL2(dimension)
|
17 |
+
index.add(np.stack(data['embedding'].values))
|
18 |
|
19 |
# Load QA model
|
20 |
qa_model = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
|