Spaces:
Sleeping
Sleeping
kurniawan
commited on
Commit
·
1836fa2
1
Parent(s):
7791531
Convert to Streamlit app
Browse files- README.md +2 -2
- app.py +8 -20
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -3,8 +3,8 @@ title: Simple Input Output App
|
|
| 3 |
emoji: 🚀
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 3 |
emoji: 🚀
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.28.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
CHANGED
|
@@ -1,23 +1,11 @@
|
|
| 1 |
-
import
|
| 2 |
|
| 3 |
-
|
| 4 |
-
if not text:
|
| 5 |
-
return "Please enter some text!"
|
| 6 |
-
|
| 7 |
-
output = f"""
|
| 8 |
-
You entered: {text}
|
| 9 |
-
Character count: {len(text)}
|
| 10 |
-
Word count: {len(text.split())}
|
| 11 |
-
"""
|
| 12 |
-
return output
|
| 13 |
|
| 14 |
-
|
| 15 |
-
fn=process_input,
|
| 16 |
-
inputs=gr.Textbox(label="Enter your text", placeholder="Type something here..."),
|
| 17 |
-
outputs=gr.Textbox(label="Output"),
|
| 18 |
-
title="Simple Input/Output App",
|
| 19 |
-
description="Enter text and see character and word count"
|
| 20 |
-
)
|
| 21 |
|
| 22 |
-
if
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
|
| 3 |
+
st.title("Simple Input/Output App")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
user_input = st.text_input("Enter your text:", placeholder="Type something here...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
if user_input:
|
| 8 |
+
st.write("### Output:")
|
| 9 |
+
st.write(f"You entered: **{user_input}**")
|
| 10 |
+
st.write(f"Character count: {len(user_input)}")
|
| 11 |
+
st.write(f"Word count: {len(user_input.split())}")
|
requirements.txt
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
streamlit
|