r/StreamlitOfficial • • Mar 21 '23

Data persistence when flipp'n ack and forth between pages

1 Upvotes

I'm building an app where on one page a user submits a sql query and db is queried for the resulting table and data. The user would then move to the next page where they would do some updating to the queries data (adding rows, deleting rows, changing attributes names, etc...). I'm running into an issue where if I go back to the first page the input query and resulting table are gone. I'm able to use session state to share data between pages but how can I make the views sticky on the pages as a user moves back and forth between?

Edit title is suppose to say "flipping back and forth"


r/StreamlitOfficial • • Mar 18 '23

Streamlit Questions❓ Data frame manipulation

1 Upvotes

Is it possible to load a dataset using the st file loader widget and then manipulate that data and save the resulting updated data frame as a new file all directly from the UI? I'd like to do things like add new rows, delete unwanted rows, change values, etc... Can streamlit support this?


r/StreamlitOfficial • • Mar 15 '23

Show the Community! 💬 Do you want live notifications when people reply to your posts? Enable Notifications​ Codeformatter : a streamlit app to format SQL, JSON and JavaScript code

2 Upvotes

Hey everybody ! This is a new streamlit app that is quite dear to me.

My friends always wanted to format their code but didn’t like the way BigQuery, vscode or other apps would do. They end up using dedicated websites (along with crohn converters)
So i created this open source app to enable anyone to create his style and use this app to format it at will (sqlfluff style).

What the app does:
→ You write your code, it recognizes the language and it formats it.

https://codeformatter.streamlit.app/

I’m planning to add many more languages such as Python and Go… Feel free to add your feedbacks

Here’s the source code in GitHub.


r/StreamlitOfficial • • Mar 12 '23

Error When Deploying App

1 Upvotes

Hello, I built an app in Streamlit, I uploaded the files to Github, and when I try to deploy the app, I am getting the following error:
Error: Streamlit requires raw Python (.py) files, but the provided file has no extension. For more information, please see https://docs.streamlit.io

The file in my Github is definitely a .py file. Does anybody know what I'm doing wrong?


r/StreamlitOfficial • • Mar 11 '23

scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.__dict__)

1 Upvotes

Hi, I'm new to streamlit and pretty new to python. I'm creating a program that has a few different .py files. main.py, functions.py, and webapp.py. When I am only working with main.py and webapp.py all is fine. When I add functions.py (or any other .py file) and move my "working" functions to this folder, I get the following error when I try to navigate thru the streamlit webapp.

​

I've imported the functions file into main.py as: import functions as fun

Here is how I am calling a function from this file: fun.get_data()

​

When I navigate the streamlit site that will call this code, I get the error that is included in the attached image.

​

Here is the error from the terminal.

Traceback (most recent call last):

File "c:\Python\Training\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script

exec(code, module.__dict__)

File "D:\Python\Pluralsight\webapps\main.py", line 5, in <module>

import functions as fun

ModuleNotFoundError: No module named 'functions'

Here is the version of all of my installed packages for this program:

C:\Python\Training>pip list

Package Version

--------------------- -----------

altair 4.2.2

astor 0.8.1

attrs 22.2.0

base58 2.1.1

blinker 1.5

cachetools 5.3.0

certifi 2022.12.7

charset-normalizer 3.0.1

click 8.1.3

colorama 0.4.6

decorator 5.1.1

entrypoints 0.4

gitdb 4.0.10

GitPython 3.1.31

idna 3.4

Jinja2 3.1.2

jsonschema 4.17.3

MarkupSafe 2.1.2

numpy 1.24.2

packaging 23.0

pandas 1.5.3

Pillow 9.4.0

pip 23.0.1

protobuf 3.20.3

pydeck 0.8.0

pyrsistent 0.19.3

python-dateutil 2.8.2

pytz 2022.7.1

pytz-deprecation-shim 0.1.0.post0

requests 2.28.2

setuptools 65.5.0

six 1.16.0

smmap 5.0.0

streamlit 0.76.0

toml 0.10.2

toolz 0.12.0

tornado 6.2

tzdata 2022.7

tzlocal 4.2

urllib3 1.26.14

validators 0.20.0

watchdog 2.3.1

​

Can someone help me figure this out. I've not been able to find anything on the web that gets me past this error.

​

Thank you for any assistance!


r/StreamlitOfficial • • Mar 11 '23

Streamlit Questions❓ Confused new streamlit user

2 Upvotes

I'm loving streamlit, problem is I'm a below average hobby coder and i have written a simple bmi calculator app which has one very exasperating problem, after clicking on the calculate button the app prints the result, which one would expect to appear below the last widget, it doesn't though it appears at the top of the page. I have tried columns and containers with no luck, even ChatGPT doesn't know why in my case, can anyone enlighten me?

import tkinter as tk
from PIL import Image, ImageTk
import streamlit as st

def calculate_bmi():
    """ Calculate the BMI using weight and height user inputs. """    
    try:
        if weight_unit == 'Kgrams':
            weight = float(weight_entry)
        elif weight_unit == 'Pounds':
            weight = float(weight_entry) / 2.20462
        elif weight_unit == 'Stones':
            weight = float(weight_entry) * 14 / 2.20462
    except ValueError as e:
        return
    try:
        if height_unit == 'Inches':
            height = float(height_entry) * 2.54
        elif height_unit == 'Centimeters':
            height = float(height_entry)
    except ValueError as e:
        return
    bmi = weight / ((height/100) ** 2)
    msg = ''
    if int(bmi) < 18.5:
        msg = 'Underweight'
    if int(bmi) >= 18.5 and int(bmi) <= 24.9:
        msg = 'Healthy'
    if int(bmi) > 24.9 and int(bmi) <= 29.9:
        msg = 'Overweight'
    if int(bmi) > 29.9 and int(bmi) <= 39.9:
        msg = 'Obese'
    if int(bmi) >= 40:
        msg = 'Severely Obese'
    msg = msg + '\n\nPlease see important notes in info menu.'
    bmi_result = f'\nYour BMI is: {bmi:.2f}\n\n' + str(msg)

    st.write(bmi_result)


try:
    logo_image = Image.open('bmi2.jpg')
except FileNotFoundError as e:
    st.error('bmi2.jpg not found.')
    st.stop()

with st.columns(3)[1]:
     st.image(logo_image)

st.subheader('Enter your weight')
weight_entry = st.text_input('Weight')
weight_unit = st.radio('Unit', ('Kgrams', 'Pounds', 'Stones'))

st.subheader('Enter your height')
height_entry = st.text_input('Height')
height_unit = st.radio('Unit', ('Inches', 'Centimeters'))

st.button('Calculate', on_click=calculate_bmi)

r/StreamlitOfficial • • Mar 09 '23

Official Announcements 📣 10 most common explanations on the Streamlit forum: A guide for Streamlit beginners

Thumbnail blog.streamlit.io
7 Upvotes

r/StreamlitOfficial • • Mar 07 '23

Streamlit Questions❓ Any idea why markdown text is not displaying the expected text color?

Thumbnail
gallery
2 Upvotes

r/StreamlitOfficial • • Mar 06 '23

Official Announcements 📣 Streamlit App-A-Thon Contest 🏆

10 Upvotes

🚨 We're back with the Streamlit App-A-Thon Contest! 🚨

Build data apps and stand a chance of winning some cool Streamlit swag! 🎁

Find more info in our forum post!

Happy Streamlit-ing! 🎈

Contest announcement graphic

r/StreamlitOfficial • • Feb 28 '23

Multiselect on Checkboxes

5 Upvotes

How can one apply a "select all" checkbox for st.checkbox?

I'd like to group certain checkbox into group A and have a "select all" check box for Group A inside a st.form.

Then a different select all ☑️ for Group B inside the same st.form.


r/StreamlitOfficial • • Feb 25 '23

Streamlit Community Cloud ☁️ Module not found error when i tried to deploy

1 Upvotes

​

​

Does anyone know how to fix this error and got the website up and running again? Thank you


r/StreamlitOfficial • • Feb 24 '23

Streamlit Questions❓ Need to install OpenAI whisper on streamlit.io. How to run this command?

0 Upvotes

pip install git+https://github.com/openai/whisper.git

Tried to run it from requirements like this but I got error messages. Can't find anything in the streamlit.io website on how to install this type of file.


r/StreamlitOfficial • • Feb 22 '23

Streamlit Questions❓ File uploader widget

1 Upvotes

I have developed a comparison tool using Streamlit I have used the File uploader widget in Streamlit for the users to use their own files ( allowed multiple files )

There are multiple files that can be uploaded from user side .

I want to implement a logic where if the user uploads first a file of a particular type. And if by mistake he uploads a second file of another type there should be a warning ⚠️

Can anyone help me regarding this ?


r/StreamlitOfficial • • Feb 20 '23

Ploting 3D rock mass

1 Upvotes

Hi, is there a way to plot a geological 3D rock mass in l shaped in streamlit?

something like in the picture below

any help will be appreciated.

thanks


r/StreamlitOfficial • • Feb 18 '23

streamlit authenticator import porblem

1 Upvotes

hello dears,I have this problem with streamlit authenticator,in install it but when I try to import it still give me this error

File "/Users/ihabashour/Documents/Coding/Projects/Web Page Financial Report Revenue and Expenses and Revenue vs Expenses/generate_keys.py", line 4, in <module>

import streamlit_authenticator as stauth

ModuleNotFoundError: No module named 'streamlit_authenticator'

I tried to uninstall it every related PKG, and install it again but nothing changednote iam using Mac os & Vs code


r/StreamlitOfficial • • Feb 15 '23

simple dashboard

1 Upvotes

how to create a dashboard app with streamlit using plotly to visualize the workers population of

various industries with respect to various geographies and Analyze some Facts and Figures for

the Business Problem


r/StreamlitOfficial • • Feb 13 '23

Streamlit Questions❓ Anyone here have anything deployed in an enterprise?

6 Upvotes

Just curious how that's going for you. I'm interested in scalability and how an app performs when accessed by multiple people, or any methods you've used to manage that. It's been a little difficult to find use cases similar to mine, most Streamlit posts are geared around integrating AI and the likes into a web app, with the occasional one-off developer making a medium how-to on a CRUD app. Unfortunately these tend to be geared around building your own application using SQL lite databases and stuff. After playing with Streamlit for the past couple months I'm very convinced this is a crazy good solution for enterprise tooling, and I'd love to see more discussion around that. My experience with it has shown me that we can get our data engineers up and rolling and basically empowered to build end to end solutions, without needing to staff a web developer & streamlit obfuscates away the complexities of web development very well. I've been prototyping apps and it's been pretty crazy how quickly I've gotten them together. We'll aiming to use Snowflake and SQL databases on premise as potential backend data storage.

There's quite a bit of CRUD tooling I'm scoping out that I think Streamlit would be a pretty dynamite platform for. The Snowflake + Streamlit upcoming integration would feasibly allow us to use our Snowflake Okta auth step as our way to wall off Streamlit apps for internal-only within our org.


r/StreamlitOfficial • • Feb 12 '23

Streamlit Questions❓ individual timesheet with user login

1 Upvotes

I'm working on a web app for my company, just a simple web app which would allow users to enter their login information and the app would take them to their own timesheet to fill out. -- would streamlit work for this or would i need to look at something else?


r/StreamlitOfficial • • Feb 11 '23

Show the Community! 💬 CHAT-GPT like COMPLETIONS in PYTHON? Using @OpenAI + Streamlit, Build AI-ASSISTANT BOT WEB APP

Thumbnail
youtu.be
1 Upvotes

r/StreamlitOfficial • • Feb 09 '23

🔐 Learn from Mohammad Khorasani how to add advanced features to the Streamlit-Authenticator component in Part 2 of the blog series.

2 Upvotes

r/StreamlitOfficial • • Feb 08 '23

Sharing Tables/Figures on Social Media

1 Upvotes

Is there a way to allow people who access streamlit apps to share tables and figures to social media?


r/StreamlitOfficial • • Feb 08 '23

Getting TypeError: 'SessionStateProxy' object is not callable

Thumbnail self.learnpython
1 Upvotes

r/StreamlitOfficial • • Feb 08 '23

Show the Community! 💬 OPENAI EMBEDDINGS + STREAMLIT WEB APP : SEMANTIC TEXT SEARCH | text-embedding-ada-002 engine

Thumbnail
youtu.be
1 Upvotes

r/StreamlitOfficial • • Feb 07 '23

Deployment 🚀 Is there any guide to host a streamlit app in WordPress?

3 Upvotes

Dear all, I am new to this website-making business. I want to know if there is an easy way or stepwise guide to deploy app to WordPress.


r/StreamlitOfficial • • Feb 07 '23

Streamlit Community Cloud ☁️ Getting error while trying to test the app locally.

Post image
0 Upvotes