xiaopeiwu commited on
Commit
001531c
·
1 Parent(s): 7cdd5d0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import DistilBertTokenizer
2
+ from transformers import DistilBertForSequenceClassification
3
+ from transformers import pipeline
4
+ import gradio as gr
5
+
6
+ MODEL_PATH = "xiaopeiwu/hrw_v2"
7
+ model = DistilBertForSequenceClassification.from_pretrained(MODEL_PATH)
8
+ tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
9
+
10
+ demo = gr.Interface(
11
+ fn=clf_result,
12
+ title="Test High Risk Words model v2",
13
+ examples=["All the best lenders and rates for car loans in one AI powered marketplace", "Caregiver burnout can happen to your best employees."],
14
+ description="DistilBert for text classification model fine tuned on 70% of annotated RM production data combined with industry-specific webscrape data",
15
+ inputs=gr.Textbox(placeholder="Enter sentence here and press Submit", label="Sentence to check"),
16
+ outputs="textbox",
17
+ )
18
+
19
+ demo.launch(
20
+ share=True,
21
+ auth=("redmarkerml", "redmarkerml")
22
+ )