Priyanhsu commited on
Commit
5a82ec8
·
verified ·
1 Parent(s): aecacd2

Update sentment.py

Browse files
Files changed (1) hide show
  1. sentment.py +1 -20
sentment.py CHANGED
@@ -7,10 +7,6 @@ Original file is located at
7
  https://colab.research.google.com/drive/1ivaq7Q88JAMMQT4pr7ms9q6ZxAR4niVn
8
  """
9
 
10
- !pip install transformers
11
-
12
- !pip install gradio
13
-
14
  import gradio as gr
15
  from transformers import pipeline
16
 
@@ -32,19 +28,4 @@ iface = gr.Interface(
32
  )
33
 
34
  # Launch the interface
35
- iface.launch()
36
-
37
- import torch
38
- from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
39
-
40
- tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
41
- model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
42
-
43
- inputs = tokenizer("my friend is no more i am sad", return_tensors="pt")
44
- with torch.no_grad():
45
- logits = model(**inputs).logits
46
-
47
- predicted_class_id = logits.argmax().item()
48
- model.config.id2label[predicted_class_id]
49
-
50
- !git clone https://huggingface.co/spaces/Priyanhsu/Sentiment_analysis
 
7
  https://colab.research.google.com/drive/1ivaq7Q88JAMMQT4pr7ms9q6ZxAR4niVn
8
  """
9
 
 
 
 
 
10
  import gradio as gr
11
  from transformers import pipeline
12
 
 
28
  )
29
 
30
  # Launch the interface
31
+ iface.launch()