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()