almugabo commited on
Commit
d85deda
1 Parent(s): 6865a52

create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from setfit import SetFitModel
2
+ import gradio as gr
3
+
4
+ #load model
5
+
6
+ model = SetFitModel.from_pretrained("almugabo/review_classifier")
7
+
8
+
9
+
10
+ #prediction function
11
+ def predict_review(abstract_text):
12
+ prediction = model.predict(abstract_text)
13
+ return 'Review' if prediction == 1 else 'Not Review'
14
+
15
+
16
+ # gradio interface
17
+ interface = gr.Interface(fn=predict_review, inputs="text", outputs="label")
18
+
19
+ interface.launch()