Update app.py
Browse files
app.py
CHANGED
@@ -1,34 +1,39 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import pickle
|
4 |
-
|
5 |
-
#------------------------------------RAG BASED CHATBOT ---------------------------------------
|
6 |
-
|
7 |
-
import sys
|
8 |
-
import os
|
9 |
-
sys.path.append(os.path.abspath("src"))
|
10 |
-
|
11 |
-
from recommendationSystem.chatbot.client_module.utils import chatbot
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import pickle
|
4 |
+
|
5 |
+
#------------------------------------RAG BASED CHATBOT ---------------------------------------
|
6 |
+
|
7 |
+
import sys
|
8 |
+
import os
|
9 |
+
sys.path.append(os.path.abspath("src"))
|
10 |
+
|
11 |
+
from recommendationSystem.chatbot.client_module.utils import chatbot
|
12 |
+
|
13 |
+
# ✅ Redirect model cache and config to writable path
|
14 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
15 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/transformers"
|
16 |
+
os.environ["SENTENCE_TRANSFORMERS_HOME"] = "/tmp/sentence-transformers"
|
17 |
+
|
18 |
+
chatbot()
|
19 |
+
#render_history_download()
|
20 |
+
|
21 |
+
#----------------------------------- RECOMMEDATION SYSTEM -----------------------------------------
|
22 |
+
|
23 |
+
from utils import fetch_transformed_data, anime_info
|
24 |
+
|
25 |
+
st.title("Anime Recommender System")
|
26 |
+
|
27 |
+
data_path, matrix_path = fetch_transformed_data()
|
28 |
+
|
29 |
+
anime_data = pd.read_csv(data_path)
|
30 |
+
similarity_matrix = pickle.load(open(file=matrix_path,mode='rb'))
|
31 |
+
|
32 |
+
select_anime_name = st.selectbox(
|
33 |
+
"Choose Anime Name : ",
|
34 |
+
anime_data['title'].values,
|
35 |
+
index=None,
|
36 |
+
placeholder="Select the anime for recommendation..."
|
37 |
+
)
|
38 |
+
|
39 |
+
anime_info(anime_name=select_anime_name,anime_data=anime_data,similarity_matrix=similarity_matrix)
|