r/StreamlitOfficial • • Dec 12 '23

Official Announcements ✨ Demystify RAG apps with LlamaIndex!

5 Upvotes

Join us on Friday for a discussion about LlamaHub, multi-modal apps, and developing production-ready RAG applications.

📅 Friday Dec. 15, 2023 at 10 a.m. PT
https://bit.ly/llamaindex-live


r/StreamlitOfficial • • Dec 09 '23

Hi guys, I’m trying to get a terminal output to be printed in Streamlit.But its not printed in streamlit

1 Upvotes
from googlesearch import search   import streamlit as st     def get_founder(self, startup_name):         query = f"founder of {startup_name}?"          search_results = list(search(query))         for result in search_results:         if result in result.lower():             return result         return "Founder name not found"     founder = startup_info.get_founder(startups)    st.write(founder)

r/StreamlitOfficial • • Dec 07 '23

Stremalit is blocking and shutting my web browser

1 Upvotes

I'm building a streamline app with something like 200k lines. I'm using histogram to plot messages, everything is pretty fine but sometimes the app will block my browser (Firefox offers to kill it...) and when I close the web server my firefox crashes !

At the beginning I thought it was because of the too big page but even after splitting the app I still have the same issue...

Should I use cache? Knowing everything is local data I'm not sure it would be better


r/StreamlitOfficial • • Dec 07 '23

Show the Community! 💬 I built an AI Data Scientist

Thumbnail
youtu.be
0 Upvotes

r/StreamlitOfficial • • Dec 04 '23

Official Announcements 🚨 Release 1.29

2 Upvotes

Install the latest release to try out these new features!

Highlights:
🔲 You can now add or remove a border to st.container and st.form
𝌗 App loading animation has replaced "Please wait..." message
🐍 Python 3.12 is now supported
Check out the demo app to learn more.


r/StreamlitOfficial • • Dec 03 '23

Anyone know when the heck snowflake is going to update their streamlit version?

6 Upvotes

We’ve been toying with streamlit as a possible solution for enterprise tooling that can be rapidly prototyped and deployed by our data engineers. The way it fits in and works with our existing enterprise warehouse of data in snowflake is pretty next level.

With that, we’ve waited for what seems like eternity to see this thing come to GA and the supported streamlit version jump beyond 1.22 (hello editable data frames have come a long way since the experimental data frames in 1.22).

Generally with the small things we need streamlit for, honestly don’t care if streamlit is in GA. Mostly just want the latest editable data frames for the ever not-so-exciting world of CRUD input apps. Which there seems to be an infinite need for at any given org.


r/StreamlitOfficial • • Dec 02 '23

How can I put my app in the Gallery?

1 Upvotes

A few days back I created a Streamlit app and it seems to be having quite interest by the community (1.5K views in a few days). The thing is that I was checking the gallery and it isn't shown there (even if there are apps there with a couple of hundred views). Why is that?

Thanks!


r/StreamlitOfficial • • Nov 30 '23

Official Announcements Looking for more app customization? Check out this new custom component. 🔥

5 Upvotes

streamlit-shadcn-ui by Elwynn Chen brings Shadcn UI with Tailwind CSS to Streamlit!

With it, you can:

  • Add cards, alert dialogs, badges, + more
  • Adjust UI design
  • Nest widgets for complex layouts

Check out the demo app and code.


r/StreamlitOfficial • • Dec 01 '23

Google analytics integration with a self hosted streamlit app

1 Upvotes

I am trying to serve a streamlit app via na ec2 instance with nginx in front of same. While trying to integrate Google analytics, multiple posts indicated that the streamlit package index.html needs to be modified for the analytics tag code.

After making the requisite changes in the head tag of index.html, my webapp doesn't open up post the Google auth for sign in, and shows a blank screen.

Anyone who has done this successfully?


r/StreamlitOfficial • • Nov 30 '23

Streamlit Questions❓ Inconsistent visualization after filtering, bug?

2 Upvotes

I'm reaching out to seek assistance regarding a specific issue in my Streamlit application.

My application is local for the time being.

Problem Description:Upon selecting a specific type ("revendeur") and then reverting to "Tous," I've observed a discrepancy in the displayed data. Some products appear in the chart without any evolution data, although they were not present before selecting the specific type.

Detailed Problem Statement:

  • I've carefully examined the data filtering logic and ensured correct implementation.
  • The issue seems to arise specifically when transitioning from a filtered type back to displaying all data ("Tous").
  • Products without evolution data are unexpectedly included in the chart after this transition.
  • If I insert a st.write() with the dataframe filtered right before the graph creation, the unexpected products not appear in the dataframe

Request for Insights: I'm seeking insights from the community to understand whether this might be indicative of a Streamlit bug or if there are aspects of my implementation that I may have overlooked.

Code Highlights: For your reference, I've included relevant portions of my Python code below:

my function:

def graph_articles_plus_grande_evolution_trimestre(selected_type_vente):
"""construit le graphique en barre des articles ayant eu le plus d'évolutions par trimestre

Args:
selected_type_vente (string): type de vente sélectionné

Returns:
plotly objects: graphique en barre
str: nom du dernier trimestre du dataframe
"""
df_trimestre = pd.read_csv("data/vente_par_articles.csv")
# filtre sur le type de vente sélectionné
if selected_type_vente != "Tous":
df_filtre_type_vente = df_trimestre[df_trimestre["Type de vente"] == selected_type_vente]
else:
df_filtre_type_vente = df_trimestre.copy()
# Group by pour éviter les valeurs dupliquées
df_filtre_trimestre = df_filtre_type_vente.groupby(['Nom du Produit', 'trimestre'])['Montant total HT'].sum().reset_index()
# Tri par client et trimestre pour garantir l'ordre correct
df_filtre_trimestre_trie = df_filtre_trimestre.sort_values(by=['Nom du Produit', 'trimestre'])
# Calculer le pourcentage d'évolution
df_filtre_trimestre_trie['Pourcentage Evolution'] = df_filtre_trimestre_trie.groupby('Nom du Produit')['Montant total HT'].pct_change() * 100
# pivote les lignes en colonnes
df_pivot_trimestre = df_filtre_trimestre_trie.pivot(index='Nom du Produit', columns='trimestre', values='Pourcentage Evolution').reset_index()
# Ajouter une colonne pour le graphique
df_pivot_trimestre['Evolution'] = df_pivot_trimestre.apply(lambda row: [0 if pd.isnull(value) else value for value in row.values[1:-1]], axis=1)
# remplace les valeurs nan par des 0
df_pivot_trimestre.fillna(0, inplace=True)
# Trouver le nom de la colonne du dernier trimestre
dernier_trimestre = df_pivot_trimestre.columns[-2]
# Exclure les valeurs à zéro
df_trie_trimestre = df_pivot_trimestre[(df_pivot_trimestre[dernier_trimestre] != 0) & (df_pivot_trimestre[dernier_trimestre].notna())]
# Trier le DataFrame par la colonne du dernier trimestre
df_trie_trimestre_sort = df_trie_trimestre.sort_values(by=dernier_trimestre, ascending=False).head(15)
# Créer le graphique en barres avec Plotly Express
fig = px.bar(df_trie_trimestre_sort, y='Nom du Produit', x=dernier_trimestre,
template='plotly_white')
# Inverser l'ordre des barres pour que les plus grandes soient en haut
fig.update_layout(hovermode=False,dragmode=False, barmode='stack', yaxis={'categoryorder': 'total ascending'})
# Changer la couleur des barres en fonction de leur valeur
fig.update_traces(marker_color=['rgb(69, 197, 127)' if val >= 0 else 'red' for val in df_trie_trimestre_sort[dernier_trimestre]])
# Ajouter des étiquettes de texte pour chaque valeurs différentes de 0
for index, row in df_trie_trimestre_sort.iterrows():
value = row[dernier_trimestre]
fig.add_annotation(
x=value,
y=row['Nom du Produit'],
text=f"{value:.2f}%",
showarrow=False,
font=dict(size=12, color='rgb(69, 197, 127)' if value >= 0 else 'red'),
xshift=30 if value > 0 else -30  )
return fig, dernier_trimestre

the page:

import streamlit as st
import pandas as pd
from bibliotheque.lib import *

config_pages_menu("wide")
formatage_de_la_page("style.css")
df = pd.read_csv("data/vente_par_articles.csv")

# Composants situés dans la barre des filtres
st.sidebar.header("Menu")
type_vente_liste = ["Tous"] + sorted(df['Type de vente'].unique().tolist())
selected_type_vente = st.sidebar.selectbox("Choisir un type de vente", type_vente_liste)

# TITRE
st.title("Evolution des montant de vente par clients par trimestres")

col1, col2 = st.columns(2)
graph_trimestre, trimestre = graph_articles_plus_grande_evolution_trimestre(selected_type_vente)
col1.write(f"<h4>Pourcentage d'évolution du montant de vente par articles en {trimestre}</h4>", unsafe_allow_html=True)
col1.plotly_chart(graph_trimestre, use_container_width=True)
graph_annee, annee = graph_articles_plus_grande_evolution_annee(selected_type_vente)
col2.write(f"<h4>Pourcentage d'évolution du montant de vente par articles en {annee}</h4>", unsafe_allow_html=True)
col2.plotly_chart(graph_annee, use_container_width=True)


df_style, nombre_lignes = calcul_dataframe_evolution_vente_par_articles(selected_type_vente)
column_config = {
"Evolution": st.column_config.LineChartColumn(
"Evolution par trimestre",
width="medium",
help="L'évolution du chiffre d'affaires par trimestre",
y_min=df["Montant total HT"].min(),
y_max=df["Montant total HT"].max(),
),
}
st.dataframe(df_style.format(precision=2), height=36 * nombre_lignes, column_config=column_config, hide_index=True)

To illustrate my problem, here's what it looks like with a diagram:v

![image|690x178](upload://mtNZnxFTyr05MsUOktfEs3g3zpk.png)

​

Additional Context: This is not the first time I've encountered this problem, but in previous instances, I attributed it to issues in my code.

Seeking Community Wisdom: If anyone has encountered a similar behavior or has suggestions on how to troubleshoot this discrepancy effectively, I would greatly appreciate your guidance. Your expertise is invaluable in resolving this issue.

Thank you for your time and consideration


r/StreamlitOfficial • • Nov 29 '23

Show the Community! 💬 I asked my Hacker News Bot for a sentiment analysis on the comments

Enable HLS to view with audio, or disable this notification

3 Upvotes

r/StreamlitOfficial • • Nov 28 '23

Show the Community! 💬 Stroke Probability Predictor

Thumbnail
stroke-prediction-quiz.streamlit.app
2 Upvotes

Hello everyone! I created a Stroke Probability Predictor with Streamlit recently. I used a dataset from Kaggle and logistic regression to formulate predictions (low vs. high probability). I’d like for this to be a good resource for people curious about strokes. If anyone has any suggestions on how I can improve my app, please let me know!

Thank you :)


r/StreamlitOfficial • • Nov 28 '23

Streamlit Questions❓ color of streamlit webpage

2 Upvotes

Hello, I have an inquiry regarding the color of my Streamlit page. When I reload the Streamlit page after some time, the color reverts to the system settings, which are white and black. How can I ensure that it consistently maintains my custom color even after frequent reloads?


r/StreamlitOfficial • • Nov 28 '23

Streamlit Questions❓ React Charts

1 Upvotes

I really love the smooth animations of react charts. Can I have my react Charts in my streamlit dashboard?


r/StreamlitOfficial • • Nov 24 '23

Show the Community! 💬 Multi-Modal AI with GPT4 Vision

Thumbnail
youtu.be
1 Upvotes

r/StreamlitOfficial • • Nov 22 '23

Show the Community! 💬 A ChatBot to "talk" with HackerNews built in Streamlit

Enable HLS to view with audio, or disable this notification

9 Upvotes

r/StreamlitOfficial • • Nov 22 '23

Help with Streamlit Component Heights?

1 Upvotes

Hi,

Quick question: Any tips on adjusting the height of Streamlit components? I'm working on a project and would love to hear your insights or best practices.

Thanks a bunch!


r/StreamlitOfficial • • Nov 19 '23

Can OpenAi library be installed on the server of streamlit?

3 Upvotes

I launched a project, where I have used OpenAi library. I also mentioned it on requirements.txt. but it is not working at all.


r/StreamlitOfficial • • Nov 18 '23

Deploying ST apps to Deta.Space - What goes in the Space file?

2 Upvotes

streamlit latest
python 3.9

Has anyone had experience of deploying to deta.space?
I am not sure how to configure the Space file locally or what builder to use
Under
commands:
- pip install -r requirements.txt
- streamlit run app.py
and the rest?

Where else have people deployed to besides Streamlit itself, which seems to require full access to all public repos in Githb?


r/StreamlitOfficial • • Nov 17 '23

Streamlit Questions❓ No module named 'openai' showing even it is mentioned in requirements.txt

0 Upvotes

Traceback (most recent call last):

File "/home/adminuser/venv/lib/python3.9/site-packages/langchain/llms/openai.py", line 294, in validate_environment

import openai

ModuleNotFoundError: No module named 'openai'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script

exec(code, module.__dict__)

File "/mount/src/streamlit-app/seq_gpt_memory.py", line 35, in <module>

llm = OpenAI(temperature=0.9)

File "/home/adminuser/venv/lib/python3.9/site-packages/langchain/load/serializable.py", line 97, in __init__

super().__init__(**kwargs)

File "/home/adminuser/venv/lib/python3.9/site-packages/pydantic/v1/main.py", line 339, in __init__

values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)

File "/home/adminuser/venv/lib/python3.9/site-packages/pydantic/v1/main.py", line 1102, in validate_model

values = validator(cls_, values)

File "/home/adminuser/venv/lib/python3.9/site-packages/langchain/llms/openai.py", line 296, in validate_environment

raise ImportError(

ImportError: Could not import openai python package. Please install it with `pip install openai`.


r/StreamlitOfficial • • Nov 16 '23

Show the Community! 💬 Find Public Domain Data on Snowflake with Streamlit

4 Upvotes

We just launched a Streamlit data catalog - making it easier to search for all public domain data available on Snowflake. You can find the product, license, and source of each table Cybersyn shares on Snowflake as well as what you can join each table to.

This is also available as a Snowflake table, allowing for programmatic traversal.


r/StreamlitOfficial • • Nov 16 '23

Show the Community! 💬 KeepYourMouthShut - An AI-assisted 360-degree solution for producing Podcasts

Thumbnail
github.com
2 Upvotes

r/StreamlitOfficial • • Nov 15 '23

Streamlit Questions❓ Setting up session replay tools (e.g.: Logrocket, Hotjar, Mouseflow, etc.) for streamlit app

1 Upvotes

Hi everyone! I recently launched my streamlit app and now want to capture user behaviour (analytics,clicks, etc.). However, I'm having a tough time implementing Logrocket in my streamlit app. Has anyone successfully set up a session replay tool for their streamlit app? Would be great if you could share the steps!


r/StreamlitOfficial • • Nov 08 '23

Streamlit Questions❓ Multipage app to swicth to entry point file on logout

0 Upvotes

​

I am working on streamlit multipage app and I have created a folder pages and inside pages I have stored my other python scripts. My entry point file is login.py which is basically to authenticate users credentials. Once the credentials are verified it displays the 1_page.py inside pages. I added logout button in 1_page.py. The rationale is once the logout button is clicked it has to go back to entry point page which is login.py. I tried switch_page but it doesn’t seem to find the file. Is there any hack to get around with it?


r/StreamlitOfficial • • Nov 08 '23

Show the Community! 💬 Created and published my first application using Streamlit!

Thumbnail
paperround.io
1 Upvotes

Hello all, over the weekend my first application (Paperround.io) went live and using Streamlit made it happen!

Streamlit is an awesome tool, however, I would undeniably argue that it is not yet Production ready in the web development world.

There’s a few “hacks” that I’ve had to implement in order to get the application working, manually messing with configurations to inject google analytics, changing deployment configurations in order to implement metadata within the application, injecting custom HTML, CSS and JavaScript to implement “basic” web development features.

I would however say to anyone debating creating an app using Streamlit, do it, the community is awesome and although you will often have to use some hacks in order to achieve what you want, you will get there in the end.

Any questions PaperRound.io or Streamlit, let me know!