anveshplus commited on
Commit
d4b4f47
·
verified ·
1 Parent(s): ad5397c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -0
app.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def encode(text):
4
+ # Placeholder for encoding logic
5
+ return f"Encoded: {text}"
6
+
7
+ def decode(text):
8
+ # Placeholder for decoding logic
9
+ return f"Decoded: {text}"
10
+
11
+ st.set_page_config(page_title="Telugu BPE Tokenizer", layout="centered", initial_sidebar_state="expanded")
12
+ st.markdown("<h1 style='color: #2ECC40; text-align: center;'>Telugu BPE Tokenizer</h1>", unsafe_allow_html=True)
13
+
14
+ # Add custom CSS for styling
15
+ st.markdown(
16
+ """
17
+ <style>
18
+ .title {
19
+ color: #FFFFFF;
20
+ background-color: #2C3E50;
21
+ font-family: "Arial", sans-serif;
22
+ font-size: 2.5em;
23
+ padding: 20px;
24
+ text-align: center;
25
+ }
26
+ .subheader {
27
+ color: #2980B9;
28
+ font-size: 1.5em;
29
+ }
30
+ .text-area {
31
+ background-color: #ECF0F1;
32
+ border: 1px solid #BDC3C7;
33
+ border-radius: 5px;
34
+ }
35
+ .orange-button {
36
+ background-color: #FFA500; /* Bright orange color */
37
+ color: white;
38
+ border: none;
39
+ border-radius: 5px;
40
+ padding: 10px 20px;
41
+ cursor: pointer;
42
+ }
43
+ </style>
44
+ """, unsafe_allow_html=True
45
+ )
46
+
47
+ # Create two columns for encoder and decoder
48
+ col1, col2 = st.columns(2)
49
+
50
+ with col1:
51
+ st.markdown("<div class='subheader' style='color: #FFA500;'>Encoder</div>", unsafe_allow_html=True)
52
+ encoder_input = st.text_area("Input Text for Encoding", placeholder="Enter text to encode...", key="encoder_input", height=100)
53
+ if st.button("Encode", key="encode_button"):
54
+ encoder_output = encode(encoder_input)
55
+ st.text_area("Encoded Output", value=encoder_output, height=100, disabled=True, key="encoder_output")
56
+
57
+ with col2:
58
+ st.markdown("<div class='subheader' style='color: #FFA500;'>Decoder</div>", unsafe_allow_html=True)
59
+ decoder_input = st.text_area("Input Text for Decoding", placeholder="Enter text to decode...", key="decoder_input", height=100)
60
+ if st.button("Decode", key="decode_button"):
61
+ decoder_output = decode(decoder_input)
62
+ st.text_area("Decoded Output", value=decoder_output, height=100, disabled=True, key="decoder_output")
63
+
64
+ st.markdown("<hr style='border: 1px solid #BDC3C7;'>", unsafe_allow_html=True) # Add a horizontal line above the section in grey
65
+ # Add sample texts at the end of the page
66
+ st.markdown("<div class='subheader'>Sample Texts</div>", unsafe_allow_html=True)
67
+
68
+ st.markdown("<br>", unsafe_allow_html=True)
69
+
70
+ st.markdown("<div style='margin-bottom: 10px;'> <span style='font-weight: bold;'>రెండు&nbsp;&nbsp;విధాలా&nbsp;&nbsp;ఆలోచిస్తా.</span></div>", unsafe_allow_html=True)
71
+ st.markdown("<div style='margin-bottom: 10px;'> <span style='font-weight: bold;'>మోదీ&nbsp;&nbsp;మార్కు&nbsp;&nbsp;రాజకీయం.</span></div>", unsafe_allow_html=True)
72
+ st.markdown("<div style='margin-bottom: 10px;'> <span style='font-weight: bold;'>తెలుగు&nbsp;&nbsp;భాష&nbsp;&nbsp;ఒక&nbsp;&nbsp;ద్రావిడ&nbsp;&nbsp;భాష.</span></div>", unsafe_allow_html=True)
73
+
74
+ if __name__ == "__main__":
75
+ st.write("Streamlit app is running...")
76
+ st.write("To view this page in your browser, run the command: `streamlit run app.py` and open the provided local URL.")