Spaces:
Runtime error
Runtime error
Poe Dator
commited on
Commit
•
ad37abf
1
Parent(s):
7add069
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import torch
|
3 |
from torch import nn
|
4 |
-
from transformers import BertModel, AutoTokenizer
|
5 |
from time import time
|
6 |
import matplotlib.pyplot as plt
|
7 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
@@ -58,11 +58,11 @@ def inference(txt):
|
|
58 |
|
59 |
def infer_and_display_result(txt):
|
60 |
start_time = time()
|
61 |
-
|
|
|
62 |
res = inference(txt)
|
63 |
res.sort(key = lambda x : - x[1])
|
64 |
|
65 |
-
st.subheader("Inference results:")
|
66 |
for lbl, score in res:
|
67 |
if score >=1:
|
68 |
st.write(f"[ {lbl:<7}] {labels_decoder[lbl]:<35} {score:.1f}%")
|
@@ -98,7 +98,7 @@ comment = """This application estimates probability that certain article belongs
|
|
98 |
- 'stat.ML': 'Machine Learning (stat)',
|
99 |
- 'cs.CV': 'Computer Vision',
|
100 |
- 'cs.LG': 'Machine Learning' """.replace("'", '')
|
101 |
-
st.
|
102 |
|
103 |
text1 = st.text_area("ENTER ARTICLE TITLE OR ABSTRACT HERE:")
|
104 |
text2 = '' # st.text_area("ENTER ARTICLE ABSTRACT HERE")
|
|
|
1 |
import streamlit as st
|
2 |
import torch
|
3 |
from torch import nn
|
4 |
+
from transformers import BertModel, AutoTokenizer
|
5 |
from time import time
|
6 |
import matplotlib.pyplot as plt
|
7 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
58 |
|
59 |
def infer_and_display_result(txt):
|
60 |
start_time = time()
|
61 |
+
st.subheader("Inference results:")
|
62 |
+
|
63 |
res = inference(txt)
|
64 |
res.sort(key = lambda x : - x[1])
|
65 |
|
|
|
66 |
for lbl, score in res:
|
67 |
if score >=1:
|
68 |
st.write(f"[ {lbl:<7}] {labels_decoder[lbl]:<35} {score:.1f}%")
|
|
|
98 |
- 'stat.ML': 'Machine Learning (stat)',
|
99 |
- 'cs.CV': 'Computer Vision',
|
100 |
- 'cs.LG': 'Machine Learning' """.replace("'", '')
|
101 |
+
st.markdown(comment)
|
102 |
|
103 |
text1 = st.text_area("ENTER ARTICLE TITLE OR ABSTRACT HERE:")
|
104 |
text2 = '' # st.text_area("ENTER ARTICLE ABSTRACT HERE")
|