File size: 597 Bytes
c33019a
 
6f79036
c33019a
 
 
 
 
 
 
 
6f79036
c33019a
 
 
 
9002061
0308224
f7a4208
19b9239
c33019a
 
 
 
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
import gradio as gr
from transformers import pipeline
import pandas as pd 

# Load the genre prediction model as a pipeline
pipe = pipeline(model="Stanford-TH/GenrePrediction", trust_remote_code=True)

def classify_movie_genre(description):
    # Get predictions using the pipeline
    predictions = pipe(description)
    
    return pd.DataFrame([predictions])

# Define the Gradio interface
iface = gr.Interface(
    fn=classify_movie_genre,
    inputs="textarea",
    outputs="dataframe",
    live=False,
    title="Genre Prediction"
)

# Launch the Gradio interface
iface.launch(inline=False)