Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
def extract_text(text):
|
| 4 |
+
# Extract the first 100 characters
|
| 5 |
+
extracted_text = text[:100]
|
| 6 |
+
return extracted_text
|
| 7 |
+
|
| 8 |
+
# Streamlit UI
|
| 9 |
+
st.title('Text Extraction App')
|
| 10 |
+
|
| 11 |
+
# Text input
|
| 12 |
+
user_input = st.text_area('Enter your text here:', '')
|
| 13 |
+
|
| 14 |
+
# Button to trigger extraction
|
| 15 |
+
if st.button('Extract Text'):
|
| 16 |
+
if user_input:
|
| 17 |
+
extracted_text = extract_text(user_input)
|
| 18 |
+
st.write('Extracted Text:')
|
| 19 |
+
st.write(extracted_text)
|
| 20 |
+
else:
|
| 21 |
+
st.warning('Please enter some text before extracting.')
|