Spaces:
Sleeping
Sleeping
File size: 2,291 Bytes
b7a1a13 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
import streamlit as st
import time
from utils import valid_url
from model import get_tidy_tab_t5, predict_model_t5
from model import get_tidy_tab_pegasus, predict_model_pegasus
from model import load_model_bart, predict_model_bart
from loadhtml import get_content
## Site
st.title("Tab Recall Simplified π")
st.markdown("Condense your Browser Tabs into a few impactful words. - Inspired in Arc Max Browser")
# load model
# Sidebar
st.sidebar.caption("Tidy Tabs - Title")
user_input_url = st.sidebar.text_input('Enter your url:')
error_message_url = None
def load_tab():
if(user_input_url):
# Error message state
if(error_message_url):
error_message_url.empty()
is_url_valid,url = valid_url(user_input_url)
if is_url_valid:
text, title = get_content(url)
if(text == ""):
print("error")
else:
with st.spinner('Wait for it...'):
st.sidebar.write(f'<title>: **{title}**')
time.sleep(1)
with st.spinner('Wait for it...'):
st.sidebar.write(f'T5-small: **{predict_model_t5(text)}**')
with st.spinner('Wait for it...'):
st.sidebar.write(f'Pegasus xsum: **{predict_model_pegasus(text)}**')
with st.spinner('Wait for it...'):
st.sidebar.write(f'Pegasus Bart: **{predict_model_bart(text)}**')
else:
error_message = st.sidebar.error(f'{text} is not a valid URL. Please enter a valid URL.')
button_clicked = st.sidebar.button("Load tab", on_click=load_tab())
st.sidebar.divider()
with st.status("Loading models...", expanded=True, state="complete") as models:
st.write("Loading https://huggingface.co/wgcv/tidy-tab-model-t5-small")
get_tidy_tab_t5()
st.write("Loaded T5-Small...")
st.write("Loaded from https://huggingface.co/wgcv/tidy-tab-model-pegasus-xsum")
get_tidy_tab_pegasus()
st.write("Loaded Pegasus xsum...")
st.write("Loaded from https://huggingface.co/wgcv/tidy-tab-model-bart-large-cnn")
load_model_bart()
st.write("Loaded Pegasus Bart-Large...")
models.update(label="All models loaded!", state="complete", expanded=False)
|