Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import ( | |
AutoModelForSequenceClassification, | |
AutoTokenizer, | |
pipeline | |
) | |
tokenizer = AutoTokenizer.from_pretrained( | |
'airesearch/wangchanberta-base-att-spm-uncased' | |
) | |
model = AutoModelForSequenceClassification.from_pretrained( | |
'airesearch/wangchanberta-base-att-spm-uncased', | |
revision='finetuned@wisesight_sentiment-v1.1', | |
) | |
text_cls_pipeline = pipeline(task='sentiment-analysis', | |
tokenizer=tokenizer, | |
model=model, | |
return_all_scores=True) | |
def main(): | |
st.title("Text") | |
with st.form("text_field"): | |
text = st.text_area('enter some text:') | |
# clicked==True only when the button is clicked | |
clicked = st.form_submit_button("Submit") | |
if clicked: | |
results = text_cls_pipeline([text]) | |
st.json(results) | |
if __name__ == "__main__": | |
main() |