kargaranamir commited on
Commit
46cacbc
1 Parent(s): 4f95e65

Add application file

Browse files
Files changed (2) hide show
  1. app.py +38 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import
2
+ import streamlit as st
3
+ from parstdex import Parstdex
4
+
5
+ # set config
6
+ st.set_page_config(layout="wide", page_title="Parstdex")
7
+
8
+ model = Parstdex()
9
+ model.extract_span("تست: ساعت ۸ صبح")
10
+
11
+
12
+
13
+ # APP
14
+ # set title and subtitle
15
+ st.title("Parstdex")
16
+ st.markdown("Paste any persian (farsi) text you want to extract its time and date 🖖.")
17
+ # create the input text box and setting panel
18
+ text = st.text_area('Paste your text here...', "ساعت ۸ صبح من و علی قرار گذاشتیم که شانزده بهمن ۱۳۷۵ هم دیگر را در دوشنبه بازار ببینیم.", height=50)
19
+ button = st.button("Extract")
20
+
21
+ # if button is clicked
22
+ with st.spinner("Processing Text and Extracting..."):
23
+ if button and text:
24
+ # extract markers from the text
25
+ spans = model.extract_span(sentence)
26
+ markers = model.extract_marker(sentence)
27
+ values = model.extract_value(sentence)
28
+ ners = model.extract_ner(sentence)
29
+
30
+ # display the result
31
+ st.markdown("**Spans:**")
32
+ st.write(spans)
33
+ st.markdown("**Markers:**")
34
+ st.write(markers)
35
+ st.markdown("**Values:**")
36
+ st.write(values)
37
+ st.markdown("**NER:**")
38
+ st.write(ners)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ parstdex==1.1.0