sayem ahmed shayeed commited on
Commit
df3d967
·
verified ·
1 Parent(s): b58029e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,12 +1,13 @@
1
- import gradio as gr
 
 
2
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
3
 
4
  model_name = "shayeedahmed/psyche-bert-emotion-classifier"
 
5
  tokenizer = AutoTokenizer.from_pretrained(model_name)
6
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
  classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
8
 
9
- def classify_emotion(text):
10
- return classifier(text)
11
-
12
- gr.Interface(fn=classify_emotion, inputs="text", outputs="label").launch()
 
1
+ pip install transformers
2
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
3
+ pip install huggingface_hub
4
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
5
 
6
  model_name = "shayeedahmed/psyche-bert-emotion-classifier"
7
+
8
  tokenizer = AutoTokenizer.from_pretrained(model_name)
9
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
10
  classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
11
 
12
+ result = classifier("Hello, how are you?")
13
+ print(result)