Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,9 @@ import speech_recognition as sr
|
|
7 |
# Load the Netflix dataset from CSV
|
8 |
@st.cache_data
|
9 |
def load_data():
|
10 |
-
|
|
|
|
|
11 |
|
12 |
# Load DialoGPT model and tokenizer
|
13 |
@st.cache_resource
|
@@ -19,12 +21,14 @@ def load_model():
|
|
19 |
# Function to search the dataset for movie details
|
20 |
def search_movie_details(query, data):
|
21 |
query = query.lower()
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
]
|
|
|
28 |
return results
|
29 |
|
30 |
# Function to convert voice to text
|
@@ -70,7 +74,7 @@ if user_input:
|
|
70 |
st.write(f"**Director:** {row['director']}")
|
71 |
st.write(f"**Cast:** {row['cast']}")
|
72 |
st.write(f"**Release Year:** {row['release_year']}")
|
73 |
-
st.write(f"**Country:** {row['country']}") # ✅ Now
|
74 |
st.write(f"**Rating:** {row['rating']}")
|
75 |
st.write(f"**Description:** {row['description']}")
|
76 |
st.write("---")
|
@@ -80,3 +84,4 @@ if user_input:
|
|
80 |
outputs = model.generate(inputs, max_length=100, num_return_sequences=1)
|
81 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
82 |
st.write(f"Chatbot: {response}")
|
|
|
|
7 |
# Load the Netflix dataset from CSV
|
8 |
@st.cache_data
|
9 |
def load_data():
|
10 |
+
df = pd.read_csv("https://huggingface.co/spaces/mfraz/Netflix-data/resolve/main/netflix_titles.csv")
|
11 |
+
df.fillna("N/A", inplace=True) # Replace NaN values with "N/A"
|
12 |
+
return df
|
13 |
|
14 |
# Load DialoGPT model and tokenizer
|
15 |
@st.cache_resource
|
|
|
21 |
# Function to search the dataset for movie details
|
22 |
def search_movie_details(query, data):
|
23 |
query = query.lower()
|
24 |
+
|
25 |
+
# Filtering: Ensure column names exist and search query is in title, cast, or director
|
26 |
+
results = data[
|
27 |
+
data["title"].str.lower().str.contains(query, na=False) |
|
28 |
+
data["cast"].str.lower().str.contains(query, na=False) |
|
29 |
+
data["director"].str.lower().str.contains(query, na=False)
|
30 |
]
|
31 |
+
|
32 |
return results
|
33 |
|
34 |
# Function to convert voice to text
|
|
|
74 |
st.write(f"**Director:** {row['director']}")
|
75 |
st.write(f"**Cast:** {row['cast']}")
|
76 |
st.write(f"**Release Year:** {row['release_year']}")
|
77 |
+
st.write(f"**Country:** {row['country']}") # ✅ Now displays Country correctly
|
78 |
st.write(f"**Rating:** {row['rating']}")
|
79 |
st.write(f"**Description:** {row['description']}")
|
80 |
st.write("---")
|
|
|
84 |
outputs = model.generate(inputs, max_length=100, num_return_sequences=1)
|
85 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
86 |
st.write(f"Chatbot: {response}")
|
87 |
+
|