Spaces:
Sleeping
Sleeping
Some fixes
Browse files
main.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import faiss
|
2 |
import streamlit as st
|
3 |
from transformers import AutoTokenizer, AutoModel
|
@@ -5,12 +6,15 @@ import torch
|
|
5 |
import joblib
|
6 |
import pandas as pd
|
7 |
|
|
|
|
|
|
|
8 |
# Загрузка сохраненных данных и индекса
|
9 |
-
text_embeddings = joblib.load('mail_embeddings.joblib')
|
10 |
-
index = faiss.read_index('mail_faiss_index.index')
|
11 |
|
12 |
# Датасет
|
13 |
-
df = pd.read_csv('clean_mail_movie.csv')
|
14 |
titles = df['movie_title'].tolist()
|
15 |
images = df['image_url'].tolist()
|
16 |
descr = df['description'].tolist()
|
@@ -58,4 +62,4 @@ if st.button("Найти"):
|
|
58 |
st.write(descr[index]) # Выводим описание фильма
|
59 |
|
60 |
with col3:
|
61 |
-
st.write(f"Уверенность: {(1
|
|
|
1 |
+
import numpy as np
|
2 |
import faiss
|
3 |
import streamlit as st
|
4 |
from transformers import AutoTokenizer, AutoModel
|
|
|
6 |
import joblib
|
7 |
import pandas as pd
|
8 |
|
9 |
+
def sigmoid(x):
|
10 |
+
return 1 / (1 + np.exp(-x))
|
11 |
+
|
12 |
# Загрузка сохраненных данных и индекса
|
13 |
+
text_embeddings = joblib.load('release_3/mail_embeddings.joblib')
|
14 |
+
index = faiss.read_index('release_3/mail_faiss_index.index')
|
15 |
|
16 |
# Датасет
|
17 |
+
df = pd.read_csv('release_3/clean_mail_movie.csv')
|
18 |
titles = df['movie_title'].tolist()
|
19 |
images = df['image_url'].tolist()
|
20 |
descr = df['description'].tolist()
|
|
|
62 |
st.write(descr[index]) # Выводим описание фильма
|
63 |
|
64 |
with col3:
|
65 |
+
st.write(f"Уверенность: {(1-sigmoid(distances[0][i]))*100:.1f}%") # Выводим уверенность
|