File size: 747 Bytes
2369a18
 
c6a3e36
 
 
 
 
 
2369a18
c6a3e36
1c16e20
c6a3e36
 
e336d68
4f1463f
e336d68
1c16e20
 
c6a3e36
 
 
 
 
 
 
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
import gradio as gr

# Function to handle movie rating
def rate_movie(movie_name, rating):
    if rating == "N/A":
        return f"You haven't watched '{movie_name}' yet."
    else:
        return f"You rated '{movie_name}' a {rating}/10."

# Gradio interface
with gr.Blocks(css="styles.css") as app:
    gr.Markdown("# Movie Rating App")
    movie_name = gr.Textbox(label="Movie Name", placeholder="Enter the movie name...")
    rating = gr.Slider(
        minimum=0, 
        maximum=10,
        step=0.25,
        elem_id="custom-slider"  # Add a custom ID
    )
    submit = gr.Button("Submit Rating")
    output = gr.Textbox(label="Your Feedback")
    
    submit.click(rate_movie, inputs=[movie_name, rating], outputs=output)

app.launch()