Spaces:
Runtime error
Runtime error
justheuristic
commited on
Commit
•
592bfe6
1
Parent(s):
b3a1159
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import streamlit as st
|
3 |
+
import transformers
|
4 |
+
|
5 |
+
|
6 |
+
st.markdown("Hello!")
|
7 |
+
|
8 |
+
# model, tokenizer = torch.load("/home/jheuristic/data/model.pth", map_location='cpu')
|
9 |
+
model = transformers.AutoModel.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
|
10 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
|
11 |
+
|
12 |
+
|
13 |
+
user_input = st.text_input("Please enter your thoghts:")
|
14 |
+
|
15 |
+
|
16 |
+
if len(user_input.split()) > 0:
|
17 |
+
|
18 |
+
input_kwargs = tokenizer(user_input, return_tensors="pt")
|
19 |
+
|
20 |
+
st.markdown(f"{model(**input_kwargs)}")
|