okite97 commited on
Commit
c47cc8f
·
1 Parent(s): f39942b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model_id = 'okite97/distilbert-base-uncased-najianews'
5
+ pipe = pipeline('text-classification',model=model_id)
6
+
7
+ def predict_news(title, description):
8
+ news = title + '. ' + description
9
+ outputs = pipe(news, return_all_scores=True)
10
+ return outputs
11
+
12
+
13
+ textbox1 = gr.Textbox(label="News Title" , lines=2)
14
+ textbox2 = gr.Textbox(label="Excerpt:", placeholder="John Doe", lines=2)
15
+ demo = gr.Interface(fn=predict_news, inputs = [textbox1, textbox2],
16
+ outputs = 'text')
17
+