JanaAlbader commited on
Commit
a06c696
·
verified ·
1 Parent(s): 653928a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +87 -3
app.py CHANGED
@@ -1,8 +1,92 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!" +"\n Have a Good Day!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
8
  demo.launch()
 
 
1
  import gradio as gr
2
 
3
+ # Movie recommendations by genre
4
+ movie_recommendations = {
5
+ "Animated": {
6
+ "title": "Soul (2020)",
7
+ "image_url": "https://image-url.com/soul.jpg"
8
+ },
9
+ "Fantasy": {
10
+ "title": "The Boy and the Heron (2023)",
11
+ "image_url": "https://image-url.com/the-boy-and-the-heron.jpg"
12
+ },
13
+ "Superhero": {
14
+ "title": "Spider-Man: No Way Home (2021)",
15
+ "image_url": "https://image-url.com/spider-man-no-way-home.jpg"
16
+ },
17
+ "Action": {
18
+ "title": "John Wick: Chapter 4 (2023)",
19
+ "image_url": "https://image-url.com/john-wick-4.jpg"
20
+ },
21
+ "Adventure": {
22
+ "title": "Dune (2021)",
23
+ "image_url": "https://image-url.com/dune.jpg"
24
+ },
25
+ "Drama": {
26
+ "title": "Nomadland (2020)",
27
+ "image_url": "https://image-url.com/nomadland.jpg"
28
+ },
29
+ "Comedy": {
30
+ "title": "Free Guy (2021)",
31
+ "image_url": "https://image-url.com/free-guy.jpg"
32
+ },
33
+ "Horror": {
34
+ "title": "A Quiet Place Part II (2021)",
35
+ "image_url": "https://image-url.com/a-quiet-place-2.jpg"
36
+ },
37
+ "Thriller": {
38
+ "title": "Tenet (2020)",
39
+ "image_url": "https://image-url.com/tenet.jpg"
40
+ },
41
+ "Sci-Fi": {
42
+ "title": "Blade Runner 2049 (2017)",
43
+ "image_url": "https://image-url.com/blade-runner-2049.jpg"
44
+ },
45
+ "Romance": {
46
+ "title": "The Last Letter from Your Lover (2021)",
47
+ "image_url": "https://image-url.com/the-last-letter.jpg"
48
+ },
49
+ "Mystery": {
50
+ "title": "Knives Out (2019)",
51
+ "image_url": "https://image-url.com/knives-out.jpg"
52
+ },
53
+ "Musical": {
54
+ "title": "West Side Story (2021)",
55
+ "image_url": "https://image-url.com/west-side-story.jpg"
56
+ },
57
+ "Biography": {
58
+ "title": "Bohemian Rhapsody (2018)",
59
+ "image_url": "https://image-url.com/bohemian-rhapsody.jpg"
60
+ },
61
+ "Documentary": {
62
+ "title": "The Social Dilemma (2020)",
63
+ "image_url": "https://image-url.com/social-dilemma.jpg"
64
+ },
65
+ "War": {
66
+ "title": "1917 (2019)",
67
+ "image_url": "https://image-url.com/1917.jpg"
68
+ },
69
+ "Western": {
70
+ "title": "The Power of the Dog (2021)",
71
+ "image_url": "https://image-url.com/power-of-the-dog.jpg"
72
+ }
73
+ }
74
 
75
+ # Function to recommend a movie based on the selected genre
76
+ def recommend_movie(genre):
77
+ movie = movie_recommendations.get(genre)
78
+ if movie:
79
+ return movie['title'], movie['image_url']
80
+ else:
81
+ return "No recommendation available", ""
82
+
83
+ # Gradio Interface
84
+ demo = gr.Interface(
85
+ fn=recommend_movie,
86
+ inputs=gr.inputs.Dropdown(choices=list(movie_recommendations.keys()), label="Select Genre"),
87
+ outputs=[gr.outputs.Textbox(label="Movie Title"), gr.outputs.Image(label="Movie Poster")],
88
+ title="Movie Recommendation"
89
+ )
90
 
 
91
  demo.launch()
92
+