aazankhanYousafzai commited on
Commit
0917013
·
verified ·
1 Parent(s): c4fa42e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -13
app.py CHANGED
@@ -1,11 +1,67 @@
1
  import streamlit as st
2
 
3
- st.set_page_config(page_title="Text Case Converter", layout="centered")
 
 
 
 
4
 
5
- st.title("🔤 Text Case Converter App")
6
- st.write("Convert your text into different cases instantly.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- text = st.text_area("Enter your text here:", height=200)
 
 
 
 
 
 
9
 
10
  st.markdown("### Choose Conversion")
11
 
@@ -13,21 +69,23 @@ col1, col2, col3 = st.columns(3)
13
 
14
  with col1:
15
  if st.button("UPPERCASE"):
16
- st.success(text.upper())
17
-
18
  if st.button("lowercase"):
19
- st.success(text.lower())
20
 
21
  with col2:
22
  if st.button("Title Case"):
23
- st.success(text.title())
24
-
25
  if st.button("Sentence Case"):
26
- st.success(text.capitalize())
27
 
28
  with col3:
29
  if st.button("Toggle Case"):
30
- st.success(text.swapcase())
 
 
 
 
31
 
32
- st.markdown("---")
33
- st.caption("Made with ❤️ using Streamlit")
 
1
  import streamlit as st
2
 
3
+ st.set_page_config(
4
+ page_title="Text Case Converter",
5
+ layout="centered",
6
+ page_icon="🔤"
7
+ )
8
 
9
+ # ---------- Glassmorphism + Gradient UI ----------
10
+ st.markdown("""
11
+ <style>
12
+ body {
13
+ background: linear-gradient(135deg, #667eea, #764ba2);
14
+ }
15
+ .main {
16
+ background: transparent;
17
+ }
18
+ .card {
19
+ background: rgba(255, 255, 255, 0.12);
20
+ backdrop-filter: blur(12px);
21
+ -webkit-backdrop-filter: blur(12px);
22
+ border-radius: 20px;
23
+ padding: 25px;
24
+ box-shadow: 0 8px 30px rgba(0,0,0,0.2);
25
+ max-width: 720px;
26
+ margin: auto;
27
+ }
28
+ h1, p, label, h3 {
29
+ color: #ffffff !important;
30
+ text-align: center;
31
+ }
32
+ textarea {
33
+ border-radius: 14px !important;
34
+ }
35
+ .stButton>button {
36
+ width: 100%;
37
+ height: 45px;
38
+ border-radius: 12px;
39
+ border: none;
40
+ background: linear-gradient(90deg, #ff758c, #ff7eb3);
41
+ color: white;
42
+ font-weight: bold;
43
+ transition: 0.3s ease;
44
+ }
45
+ .stButton>button:hover {
46
+ transform: scale(1.05);
47
+ background: linear-gradient(90deg, #ff5f7e, #ff6fae);
48
+ }
49
+ .footer {
50
+ text-align: center;
51
+ color: #eee;
52
+ margin-top: 15px;
53
+ font-size: 13px;
54
+ }
55
+ </style>
56
+ """, unsafe_allow_html=True)
57
 
58
+ # ---------- UI ----------
59
+ st.markdown("<div class='card'>", unsafe_allow_html=True)
60
+
61
+ st.markdown("<h1>🔤 Text Case Converter</h1>", unsafe_allow_html=True)
62
+ st.markdown("<p>Transform your text in one click</p>", unsafe_allow_html=True)
63
+
64
+ text = st.text_area("", placeholder="Type or paste your text here...", height=180)
65
 
66
  st.markdown("### Choose Conversion")
67
 
 
69
 
70
  with col1:
71
  if st.button("UPPERCASE"):
72
+ st.session_state["out"] = text.upper()
 
73
  if st.button("lowercase"):
74
+ st.session_state["out"] = text.lower()
75
 
76
  with col2:
77
  if st.button("Title Case"):
78
+ st.session_state["out"] = text.title()
 
79
  if st.button("Sentence Case"):
80
+ st.session_state["out"] = text.capitalize()
81
 
82
  with col3:
83
  if st.button("Toggle Case"):
84
+ st.session_state["out"] = text.swapcase()
85
+
86
+ if "out" in st.session_state:
87
+ st.markdown("### Output")
88
+ st.text_area("", st.session_state["out"], height=150)
89
 
90
+ st.markdown("</div>", unsafe_allow_html=True)
91
+ st.markdown("<div class='footer'>Made with ❤️ using Streamlit</div>", unsafe_allow_html=True)