ysda-demo / app.py
justheuristic's picture
Create app.py
592bfe6
raw
history blame contribute delete
573 Bytes
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)}")