niyaa commited on
Commit
5e200ff
1 Parent(s): 0bb602b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,10 +1,18 @@
1
  import streamlit as st
2
  from transformers import pipeline
 
 
3
 
 
4
 
5
- pipe = pipeline("sentiment-analysis")
 
 
 
 
 
6
  text = st.text_area("Enter some text")
7
 
8
  if text:
9
  out = pipe(text)
10
- st.json(out)
 
1
  import streamlit as st
2
  from transformers import pipeline
3
+ import torch
4
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
5
 
6
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
7
 
8
+
9
+ tokenizer = AutoTokenizer.from_pretrained("nickmuchi/sec-bert-finetuned-finance-classification")
10
+ model = AutoModelForSequenceClassification.from_pretrained("nickmuchi/sec-bert-finetuned-finance-classification")
11
+
12
+
13
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=device)
14
  text = st.text_area("Enter some text")
15
 
16
  if text:
17
  out = pipe(text)
18
+ st.json(out)