kurniawan commited on
Commit
1836fa2
·
1 Parent(s): 7791531

Convert to Streamlit app

Browse files
Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +8 -20
  3. 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: gradio
7
- sdk_version: 4.0.0
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 gradio as gr
2
 
3
- def process_input(text):
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
- demo = gr.Interface(
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 __name__ == "__main__":
23
- demo.launch()
 
 
 
 
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
- gradio==4.0.0
 
1
+ streamlit