Spaces:
Sleeping
Sleeping
create app.py
Browse files
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()
|