almugabo's picture
create app.py
d85deda verified
raw
history blame
409 Bytes
from setfit import SetFitModel
import gradio as gr
#load model
model = SetFitModel.from_pretrained("almugabo/review_classifier")
#prediction function
def predict_review(abstract_text):
prediction = model.predict(abstract_text)
return 'Review' if prediction == 1 else 'Not Review'
# gradio interface
interface = gr.Interface(fn=predict_review, inputs="text", outputs="label")
interface.launch()