Spaces:
Sleeping
Sleeping
File size: 1,047 Bytes
d2af509 28f6ce1 d2af509 28f6ce1 d2af509 12d1592 489af12 12d1592 28f6ce1 d2af509 28f6ce1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import streamlit as st
from inference import InferenceModel
st.set_page_config(layout="wide")
st.title("ArxivTopicPicker")
st.write("This app helps define category of your scientific paper based on its name and abstract.")
name = st.text_input("Paste here name of your paper")
abstract = st.text_area("Paste here abstract of your paper")
@st.cache # 👈 Add the caching decorator
def load_model():
return InferenceModel()
model = load_model()
model.inference('load')
# if name != '':
# st.text("Your paper:\n\tName: " + name + '.\n\tAbstract: ' + abstract)
if st.button("Start processing"):
if name == '':
st.write('<p style="font-family:sans-serif; color:Red; font-size: 21px;">Please, provide name of the paper!🙇♂️</p>', unsafe_allow_html=True)
else:
input_text = name + '. ' + abstract if abstract != '' else name + '.'
top_topics = model.inference(input_text)
if len(top_topics) == 0:
st.text("We don't know yet😰")
else:
st.text(top_topics) |