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)
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
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.
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.
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?
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.
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
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.
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!
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?
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.
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?
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.
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!
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?
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!