Spaces:
Sleeping
Sleeping
File size: 2,453 Bytes
bae9925 e3b51dc bae9925 e3b51dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import gradio as gr
def movie_suggestion(genre):
movies = {
"action": [
{"title": "Mad Max: Fury Road", "description": "A high-octane post-apocalyptic thriller. ππ₯"},
{"title": "John Wick", "description": "A retired hitman seeks vengeance. π΅οΈββοΈπ«"},
{"title": "Die Hard", "description": "An NYPD officer tries to save his wife and others taken hostage by terrorists. ππ§¨"}
],
"comedy": [
{"title": "The Grand Budapest Hotel", "description": "A quirky comedy set in a famous European hotel. π¨π"},
{"title": "Superbad", "description": "Two friends try to make the most of their last days of high school. ππ€£"},
{"title": "Step Brothers", "description": "Two middle-aged men become step brothers and cause chaos. π¨βπ¦±π¨βπ¦°π€ͺ"}
],
"drama": [
{"title": "The Pursuit of Happyness", "description": "A man's struggle with homelessness while raising his son. π¨βπ¦π’"},
{"title": "Forrest Gump", "description": "The story of a man's extraordinary life. πββοΈποΈ"},
{"title": "The Shawshank Redemption", "description": "A man imprisoned for a crime he didn't commit forms a friendship with a fellow inmate. ππ€"}
],
"sci-fi": [
{"title": "Dune", "description": "A young man faces his destiny on a desert planet. ποΈπ¨βπ"},
{"title": "Blade Runner 2049", "description": "A futuristic detective uncovers secrets about human existence. π€π"},
{"title": "Interstellar", "description": "A team of explorers travel through a wormhole in space. ππ"}
]
}
if genre.lower() in movies:
genre_movies = movies[genre.lower()]
suggestions = "Here are some movie suggestions based on your selected genre:\n\n"
for movie in genre_movies:
suggestions += f"**{movie['title']}**: {movie['description']}\n\n"
return suggestions
else:
return "Sorry, we don't have suggestions for that genre yet!"
interface = gr.Interface(
fn=movie_suggestion,
inputs=gr.Dropdown(["Action", "Comedy", "Drama", "Sci-Fi"], label="Choose a genre"),
outputs=gr.Markdown(),
title="Movie Suggestions",
description="Choose your preferred genre to receive a list of recommended movies."
)
interface.launch()
|