File size: 409 Bytes
d85deda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()