leadingbridge commited on
Commit
3bd86d9
Β·
1 Parent(s): a0f20a6

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py DELETED
@@ -1,21 +0,0 @@
1
- import gradio as gr
2
- from transformers import TextClassificationPipeline
3
-
4
- model_path = "leadingbridge/sentiment-analysis"
5
- tokenizer = BertTokenizerFast.from_pretrained(model_path)
6
- model = TFBertForSequenceClassification.from_pretrained(model_path, id2label={0: 'negative', 1: 'positive'} )
7
-
8
- def sentiment_analysis(text):
9
- pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer)
10
- result = pipe(text)
11
- return result
12
-
13
-
14
- with gr.Blocks() as demo:
15
- gr.Markdown("Choose the Chinese NLP model you want to use.")
16
- with gr.Tab("Sentiment Analysis"):
17
- text_button = gr.Button("proceed")
18
- text_button.click(fn=sentiment_analysis,inputs=gr.Textbox(placeholder="Enter a positive or negative sentence here..."),
19
- outputs=gr.Textbox(label="Sentiment Analysis"))
20
-
21
- demo.launch()