Spaces:
Sleeping
Sleeping
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() | |