From f22d29913e3ad42193692c9615deeee499ff9a7a Mon Sep 17 00:00:00 2001 From: Jack Weissenberger Date: Wed, 10 Feb 2021 10:58:52 -0800 Subject: [PATCH] working streamlit app --- app.py => flask_app.py | 0 requirements.txt | 3 ++- streamlit_app.py | 33 +++++++++++++++++++++++++++++++++ streamlit_note.txt | 11 +++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) rename app.py => flask_app.py (100%) create mode 100644 streamlit_app.py create mode 100644 streamlit_note.txt diff --git a/app.py b/flask_app.py similarity index 100% rename from app.py rename to flask_app.py diff --git a/requirements.txt b/requirements.txt index e22bd60..a21c2f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ flask Flask-SocketIO pandas -openai \ No newline at end of file +openai +streamlit \ No newline at end of file diff --git a/streamlit_app.py b/streamlit_app.py new file mode 100644 index 0000000..b7d2ca3 --- /dev/null +++ b/streamlit_app.py @@ -0,0 +1,33 @@ +import streamlit as st +import pandas as pd +import time + + +df = pd.DataFrame( + [ + {'building': 'Empire State', 'location': "NYC", 'height':1000}, + {'building': 'B', 'location': "LA", 'height':600}, + {'building': 'c', 'location': "Paris", 'height':900}, + {'building': 'C', 'location': "SF", 'height':800}, + {'building': 'P', 'location': "Dallas", 'height':500}, + ] +) + + + +st.title('IZE') +st.subheader('Use natural language to visualize and analyze your data') + +st.dataframe(df.head()) + +example = 'Ex: How many rows are there?' +user_input = st.text_input("Input your Query here", example) + +if user_input and user_input != example: + with st.spinner("Loading..."): + time.sleep(2) + + if user_input: + st.text(user_input) + + diff --git a/streamlit_note.txt b/streamlit_note.txt new file mode 100644 index 0000000..58a9353 --- /dev/null +++ b/streamlit_note.txt @@ -0,0 +1,11 @@ +Streamlit is literally perfect and a build your own web app that will make this infinitely easier + +File uploader: https://docs.streamlit.io/en/stable/api.html?highlight=file#streamlit.file_uploader + +spinner: https://docs.streamlit.io/en/stable/api.html#streamlit.spinner + +Deploy with authentication: https://discuss.streamlit.io/t/deployment-on-aws-with-authentication/4073 + +Deployment wiki: https://discuss.streamlit.io/t/streamlit-deployment-guide-wiki/5099 + +Session state: https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92 \ No newline at end of file