File size: 573 Bytes
592bfe6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import torch
import streamlit as st
import transformers


st.markdown("Hello!")

# model, tokenizer = torch.load("/home/jheuristic/data/model.pth", map_location='cpu')
model = transformers.AutoModel.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
tokenizer = transformers.AutoTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")


user_input = st.text_input("Please enter your thoghts:")


if len(user_input.split()) > 0:

    input_kwargs = tokenizer(user_input, return_tensors="pt")

    st.markdown(f"{model(**input_kwargs)}")