Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,27 +54,12 @@ st.markdown("""
|
|
54 |
# --------------------------
|
55 |
# Movie Dataset & Embeddings
|
56 |
# --------------------------
|
|
|
57 |
@st.cache_resource
|
58 |
def load_movie_data():
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
"title": "The Dark Knight",
|
63 |
-
"plot": "Batman faces the Joker in a battle for Gotham's soul...",
|
64 |
-
"cast": {"Christian Bale": "Bruce Wayne", "Heath Ledger": "Joker"},
|
65 |
-
"director": "Christopher Nolan",
|
66 |
-
"year": 2008
|
67 |
-
},
|
68 |
-
{
|
69 |
-
"title": "Inception",
|
70 |
-
"plot": "A thief who enters the dreams of others...",
|
71 |
-
"cast": {"Leonardo DiCaprio": "Cobb", "Tom Hardy": "Eames"},
|
72 |
-
"director": "Christopher Nolan",
|
73 |
-
"year": 2010
|
74 |
-
}
|
75 |
-
]
|
76 |
-
df = pd.DataFrame(movies)
|
77 |
-
df['context'] = df.apply(lambda x: f"Title: {x.title}\nPlot: {x.plot}\nCast: {', '.join([f'{k} as {v}' for k,v in x.cast.items()])}\nDirector: {x.director}\nYear: {x.year}", axis=1)
|
78 |
return df
|
79 |
|
80 |
@st.cache_resource
|
|
|
54 |
# --------------------------
|
55 |
# Movie Dataset & Embeddings
|
56 |
# --------------------------
|
57 |
+
# Replace load_movie_data() with:
|
58 |
@st.cache_resource
|
59 |
def load_movie_data():
|
60 |
+
dataset = load_dataset("wiki_movies", split="train")
|
61 |
+
df = pd.DataFrame(dataset)
|
62 |
+
df['context'] = df.apply(lambda x: f"Title: {x['title']}\nPlot: {x['plot']}\nCast: {x['cast']}", axis=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
return df
|
64 |
|
65 |
@st.cache_resource
|