King-8 commited on
Commit
b4ea96d
·
verified ·
1 Parent(s): e441976

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
3
 
4
- # Manually load tokenizer from base model
5
  tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
6
  model = AutoModelForSequenceClassification.from_pretrained("King-8/interview_statements")
7
 
@@ -9,9 +9,10 @@ classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
9
 
10
  def classify_statement(statement):
11
  prediction = classifier(statement)[0]
 
12
  label = prediction["label"]
13
- score = round(prediction["score"] * 100, 2)
14
- return f"Category: {label} (Confidence: {score}%)"
15
 
16
  gr.Interface(
17
  fn=classify_statement,
 
1
  import gradio as gr
2
  from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
3
 
4
+
5
  tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
6
  model = AutoModelForSequenceClassification.from_pretrained("King-8/interview_statements")
7
 
 
9
 
10
  def classify_statement(statement):
11
  prediction = classifier(statement)[0]
12
+
13
  label = prediction["label"]
14
+
15
+ return f"Predicted Category: {label}"
16
 
17
  gr.Interface(
18
  fn=classify_statement,