Stanford-TH's picture
Update app.py
6f79036 verified
raw
history blame
No virus
592 Bytes
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="text",
outputs="dataframe",
live=True,
title="Genre Prediction"
)
# Launch the Gradio interface
iface.launch(inline=False)