Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Word & Letter Counter", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.title("📝 Word & Letter Counter")
|
| 6 |
+
|
| 7 |
+
text = st.text_area(
|
| 8 |
+
"Enter your text below:",
|
| 9 |
+
height=200,
|
| 10 |
+
placeholder="Type or paste your text here..."
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
if text:
|
| 14 |
+
words = text.split()
|
| 15 |
+
word_count = len(words)
|
| 16 |
+
letter_count = len(text.replace(" ", ""))
|
| 17 |
+
|
| 18 |
+
st.subheader("📊 Results")
|
| 19 |
+
st.write(f"**Words:** {word_count}")
|
| 20 |
+
st.write(f"**Letters (excluding spaces):** {letter_count}")
|
| 21 |
+
else:
|
| 22 |
+
st.info("Please enter some text to count words and letters.")
|