isom5240ust commited on
Commit
f77bc82
·
verified ·
1 Parent(s): 0922e6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -10
app.py CHANGED
@@ -1,19 +1,10 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the text classification model pipeline
5
  classifier = pipeline("text-classification", model='isom5240ust/bert-base-uncased-emotion', return_all_scores=True)
6
 
7
  def classify_text(text):
8
- """
9
- Classifies the input text and returns the label and score of the most likely emotion.
10
 
11
- Args:
12
- text (str): The text to classify.
13
-
14
- Returns:
15
- tuple: A tuple containing the label and score of the most likely emotion.
16
- """
17
  results = classifier(text)[0]
18
 
19
  max_score = float('-inf')
@@ -29,7 +20,7 @@ def classify_text(text):
29
  # Gradio interface
30
  iface = gr.Interface(
31
  fn=classify_text,
32
- inputs=gr.Textbox(lines=3, placeholder="Enter text here..."),
33
  outputs=[
34
  gr.Textbox(label="Label"),
35
  gr.Textbox(label="Score")
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
4
  classifier = pipeline("text-classification", model='isom5240ust/bert-base-uncased-emotion', return_all_scores=True)
5
 
6
  def classify_text(text):
 
 
7
 
 
 
 
 
 
 
8
  results = classifier(text)[0]
9
 
10
  max_score = float('-inf')
 
20
  # Gradio interface
21
  iface = gr.Interface(
22
  fn=classify_text,
23
+ inputs=gr.Textbox(placeholder="Enter text here..."),
24
  outputs=[
25
  gr.Textbox(label="Label"),
26
  gr.Textbox(label="Score")