Spaces:
Sleeping
Sleeping
# import | |
import streamlit as st | |
from parstdex import Parstdex | |
# set config | |
st.set_page_config(layout="wide", page_title="Parstdex") | |
model = Parstdex() | |
# APP | |
# set title and subtitle | |
st.title("Parstdex") | |
st.markdown("Demo of Parstdex Python Package: https://github.com/kargaranamir/parstdex") | |
st.markdown("Paste any persian (farsi) text you want to extract its time and date 🖖.") | |
# create the input text box and setting panel | |
text = st.text_area('Paste your text here...', "ساعت ۸ صبح من و علی قرار گذاشتیم که شانزده بهمن ۱۳۷۵ هم دیگر را در دوشنبه بازار ببینیم.", height=50) | |
button = st.button("Extract") | |
# if button is clicked | |
with st.spinner("Processing Text and Extracting..."): | |
if button and text: | |
# extract markers from the text | |
spans = model.extract_span(text) | |
markers = model.extract_marker(text) | |
time_mls = model.extract_time_ml(text) | |
ners = model.extract_ner(text) | |
# display the result | |
st.markdown("**Span:**") | |
st.write(spans) | |
st.markdown("**Marker:**") | |
st.write(markers) | |
st.markdown("**Time_ML:**") | |
st.write(f"\u202b{time_mls}\u202c") | |
st.markdown("**NER:**") | |
st.write(ners) |