skylord commited on
Commit
b56b900
1 Parent(s): f6d8611

added components

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
3
 
4
  # Load the sentiment analysis pipeline with DistilBERT
5
  distilbert_pipeline = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
@@ -15,12 +16,14 @@ def predict_sentiment(text):
15
  score = result['score']
16
  return f"Sentiment: {label}, Confidence: {score:.2f}"
17
 
 
 
18
  # Create a Gradio interface
19
  iface = gr.Interface(fn=predict_sentiment,
20
- inputs=gr.inputs.Textbox(lines=2, placeholder="Type your text here..."),
21
  outputs="text",
22
- title="Sentiment Analysis with DistilBERT",
23
- description="This model predicts the sentiment of the input text. Enter a sentence to see if it's positive or negative.")
24
 
25
  # Launch the interface
26
  iface.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ from gradio.components import Textbox
4
 
5
  # Load the sentiment analysis pipeline with DistilBERT
6
  distilbert_pipeline = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
 
16
  score = result['score']
17
  return f"Sentiment: {label}, Confidence: {score:.2f}"
18
 
19
+ input1 = Textbox(lines=2, placeholder="Type your text here...")
20
+
21
  # Create a Gradio interface
22
  iface = gr.Interface(fn=predict_sentiment,
23
+ inputs=input1
24
  outputs="text",
25
+ title="Talk2Loop Sensitive statement tags",
26
+ description="This model predicts the sensitivity of the input text. Enter a sentence to see if it's sensitive or not.")
27
 
28
  # Launch the interface
29
  iface.launch()