Spaces:
Runtime error
Runtime error
File size: 604 Bytes
842749f 837bb92 c48a16b 837bb92 9e236a3 842749f 61ed66c 0897146 837bb92 44541e4 837bb92 44541e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import streamlit as st
import torch
from transformers import BertTokenizer, BertForMaskedLM
from transformers import BertForSequenceClassification
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
bert_classifier = BertForSequenceClassification.from_pretrained("bert_classifier", return_dict=True).train(False)
st.markdown("Hello!")
sentence = st.text_input("Please, enter your sentence. I will try to make it more positive :)")
encodings = tokenizer(sentence, return_tensors='pt', padding=True)
with torch.no_grad():
logits = bert_classifier(**encodings).logits
st.markdown(logits) |