Samuelblue commited on
Commit
5b5735c
1 Parent(s): 75916d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -17
app.py CHANGED
@@ -1,17 +0,0 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
-
4
- # Load the HuggingFace text classification model
5
- model = pipeline("text-classification", model="textattack/bert-base-uncased-imdb", tokenizer="textattack/bert-base-uncased-imdb")
6
-
7
- # Define the Gradio interface
8
- def classify_text(text):
9
- result = model(text)[0]
10
- label = result["label"]
11
- score = result["score"]
12
- return f"Label: {label}, Score: {score}"
13
-
14
- inputs = gr.inputs.Textbox(lines=5, label="Input Text")
15
- outputs = gr.outputs.Textbox(label="Classification Result")
16
-
17
- gr.Interface(fn=classify_text, inputs=inputs, outputs=outputs).launch()