Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,18 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
|
|
|
|
3 |
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
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)
|