Moiz commited on
Commit
c6a3e36
·
1 Parent(s): 2369a18

Added application form template

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -1,7 +1,24 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Function to handle movie rating
4
+ def rate_movie(movie_name, rating):
5
+ if rating == "N/A":
6
+ return f"You haven't watched '{movie_name}' yet."
7
+ else:
8
+ return f"You rated '{movie_name}' a {rating}/10."
9
 
10
+ # Gradio interface
11
+ with gr.Blocks() as app:
12
+ gr.Markdown("# Movie Rating App")
13
+ movie_name = gr.Textbox(label="Movie Name", placeholder="Enter the movie name...")
14
+ rating = gr.Radio(
15
+ choices=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "N/A"],
16
+ label="Rating",
17
+ value="N/A"
18
+ )
19
+ submit = gr.Button("Submit Rating")
20
+ output = gr.Textbox(label="Your Feedback")
21
+
22
+ submit.click(rate_movie, inputs=[movie_name, rating], outputs=output)
23
+
24
+ app.launch()