10 extra Streamlit widgets you didn't know existed

Поділитися
Вставка
  • Опубліковано 9 лип 2024
  • A neat little library with lots of hidden Streamlit gems from the official Streamlit Data Science team
    ☕ Want to support me? www.buymeacoffee.com/andfanilo
    🐦Follow my daily updates on Twitter: / andfanilo
    🗣️ My other links: linktr.ee/andfanilo
    👉 Links
    - My Sample Code: github.com/andfanilo/social-m...
    - Library: github.com/arnaudmiribel/stre...
    - Hide pages in sidebar: discuss.streamlit.io/t/how-to...
    - Function Explorer ++: discuss.streamlit.io/t/genera...
    My tools (Affiliate links to support me!)
    - 📷 Main Camera - amzn.to/3QvTosB
    - 📷 Main Lens - amzn.to/3svYCwq
    - 🎙️ Microphone - amzn.to/47l5ewA
    - 🎵 Music & Sound Effects - www.epidemicsound.com/referra...
    - 📕 Streamlit Official Book - amzn.to/3QuRPwl
    My tools (Affiliate links to support me!)
    - 📷 Main Camera - amzn.to/3QvTosB
    - 📷 Main Lens - amzn.to/3svYCwq
    - 🎙️ Microphone - amzn.to/47l5ewA
    - 🎵 Music & Sound Effects - www.epidemicsound.com/referra...
    - 📕 Streamlit Official Book - amzn.to/3QuRPwl00:00 Intro
    00:11 Logo
    00:50 Switching
    02:07 Space
    03:07 Text
    03:51 Badges
    05:02 Reactive text input
    05:53 Cards
    06:53 Faking it
    07:43 Exploring libraries
    09:24 Donations!
    🪶 33th video, out of the 35 videos for 2022 goal. I was sick for the week, so this is really an unscripted video with some quick editing, I hope it's enough for the UA-cam Algorithm :D
    👍 On this channel, we love building a lot of small yet smart Streamlit apps to improve our Python chops, and recall our stories around Data Science and Content Creation. Like & Subscribe if you would like to see more videos!
    ⚠️ Disclaimer: This video is not sponsored, I receive no compensation by any brand quoted in this video. Views are my own and do not represent my employer's.
    Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. Thank you for supporting my channel so I can continue providing you with free content!
    #streamlit #python #datascience #dataapps

КОМЕНТАРІ • 46

  • @simonecensuales640
    @simonecensuales640 Рік тому +5

    You are what streamlit community needs!!

    • @andfanilo
      @andfanilo  Рік тому +2

      Oh wow, thank you 🥺 I'm so grateful for you support 🤗 I hope we manage a small trustworthy community here, and that I'll see you around!

  • @theh1ve
    @theh1ve Рік тому +3

    Dam I love your content, not only is it informative and helpful you always have fun with it! Keep up the great work 🙂

    • @andfanilo
      @andfanilo  Рік тому +1

      I’m very grateful for your support 🤩 it’s really reinvigorating, I’m hoping to continue on this path and I look forward to seeing you around again ☺️

  • @CodingIsFun
    @CodingIsFun Рік тому +4

    *Great video, Fanilo!* I also recently discovered the streamlit-extra package. My favourite feature is the dataframe explorer.

    • @andfanilo
      @andfanilo  Рік тому +1

      Did not have time to test that yet! There are so many features in this package and still a lot more incoming, it's amazing! Are you prepping a "Turn An Excel Sheet Into An Interactive Dashboard Using Python, version 2" 🙃?
      I'm also pretty much convinced the most used streamlit-extras will eventually make their way into the Streamlit main library, so it's not like we are using features that may disappear 6 months later eheh

    • @CodingIsFun
      @CodingIsFun Рік тому +1

      @@andfanilo I am not planning to make a v2 of the Sales Dashboard, but I will surely use streamlit-extras for other projects. Good to know that it will not disappear soon. I once created a tutorial around the streamlit-authenticator package. Shortly afterwards, the package was bumped to a new version, which was not backwards compatible .🙈 I received many complaints in the comments 😅

  • @ganeshsuresh4723
    @ganeshsuresh4723 10 місяців тому +1

    Awesome video. Humble request ...kindly create a video without sidebar how to switch pages using button.

  • @M1911Original
    @M1911Original Рік тому

    Thanks man that was very useful ❤👍🏾👍🏾

    • @andfanilo
      @andfanilo  Рік тому

      Thanks for the support 😊

  • @tanaykapadia2301
    @tanaykapadia2301 Рік тому

    I NEEDED THIS RIGHT NOW AND IT WAS UPLOADED IT 10 HOURS AGO DAMN

    • @andfanilo
      @andfanilo  Рік тому

      Ahah surprise, I’m a mind reader 😆😆

  • @pablovitale6058
    @pablovitale6058 Рік тому

    Hello, Great video thank you.
    I want to know if there is a way to make a button that launch a specific keyboard shortcut ? And how to do it ? Plse

    • @andfanilo
      @andfanilo  Рік тому

      Hello!
      Out of my mind, I'm not sure it's easy to do, what kind of keyboard shortcut would you like to run from a button?

    • @pablovitale6058
      @pablovitale6058 Рік тому

      @@andfanilo I’m working on integrate label studio in my streamlit app and i need to make a button that submit the annotation in the current session. The shorcut is « ctrl + enter »

  • @debayanpaul5082
    @debayanpaul5082 Рік тому

    Is it possible to switch pages in a multi-page app when your main script file (ex: app.py) is in the main project folder (ex:Python Streamlit Project) and other pages are in a subfolder (ex:Pages)?

    • @andfanilo
      @andfanilo  Рік тому

      Hey Paul! I'm currently in holidays so I don't have a Streamlit project here, but from memory that's the only way this function works, by navigating to a script from the pages/ subfolder
      Have a nice day!

  • @mouhameddiop2245
    @mouhameddiop2245 Рік тому

    Good tuto,
    I want to open pages on the new tab of browser . I tried with webbrowser but the page open without data it is empty.
    Thank

  • @SantiagoEspinoza-ew4ku
    @SantiagoEspinoza-ew4ku 2 місяці тому

    i am creating an app that displays cards, similar to the metric cards shown on the video. However, these display info from a table, each card correspoinding to a row. I am trying to implement a funcitonality in which these cards are clickable. I wan to be able to click any card, have its info saved in session state and switch to a different page. Right now i managed to make the cards clickable and switch page by using an href anchor. However this aproach refreshes the page and thus it is not able to maintian the session state. Do you know of any alternatives to be able to switch pages when clicking a card. I also tried using streamlit buttons but i havent found a way to style them as i want them

    • @andfanilo
      @andfanilo  2 місяці тому

      Hey there!
      Unfortunately my immediate reaction was to style a button with a st.switch_page, which is the only Streamlit method to switch page without a page refresh which loses session state, so something like:
      ```
      import streamlit as st
      st.button("Does nothing")
      st.html("""
      div[data-testid="stVerticalBlock"]:has(> div > .stHtml > .switch_button) button {
      padding: 1em 2em;
      border-left: 0.5rem solid red;
      box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
      & p {
      font-size: 1.3em;
      font-weight: 700;
      color: #174C4F;
      }
      }
      """)
      if "clicked" not in st.session_state:
      st.session_state["clicked"] = False
      with st.container():
      st.html('')
      if st.button("Switch page"):
      st.session_state["clicked"] = True
      st.switch_page("pages/test1.py")
      st.button("Does nothing either")
      ```
      But it's not as stylish as a metric card...
      ...but wait, another thing you could try, and I think would work actually: when you switch page with an href anchor, you can add values as query params and treat query params as your transitional session state.
      Don't href to localhost/test1 but instead to localhost/test1?coming_from=apple, then use docs.streamlit.io/develop/api-reference/caching-and-state/st.query_params at the start of your page to retrieve the query params, initialize session state with it and continue doing your thing. That should work out.
      Hope this helps!

    • @andfanilo
      @andfanilo  2 місяці тому

      I have no clue if UA-cam correctly accepted my longer comment so here's a shorter version:
      Something you could try, when you switch page with an href anchor, you can add values as query params and treat query params as your transitional session state.
      Don't href to localhost/test1 but instead to localhost/test1?coming_from=apple, then use docs.streamlit.io/develop/api-reference/caching-and-state/st.query_params at the start of your page to retrieve the query params, initialize session state with it and continue doing your thing. That should work out.
      Hope this helps!

    • @SantiagoEspinoza-ew4ku
      @SantiagoEspinoza-ew4ku 2 місяці тому

      @@andfanilo Using query params worked perfectly! thank you for your help!

  • @jorge1869
    @jorge1869 Рік тому

    Man, you are very funny and joker, thanks. Regards

    • @andfanilo
      @andfanilo  Рік тому

      Glad you enjoyed! :) see you soon!

  • @anhluyendo4012
    @anhluyendo4012 Рік тому

    Hello, i need to load 5gb data into streamlit. And i try to deploy it to Streamlit Cloud however it take too long 3 days up to now still not finish. Can you help me

    • @andfanilo
      @andfanilo  Рік тому

      Hello! I'm currently in holidays so I couldn't look through it, but I think there's a storage limit on Streamlit Cloud. You can instead put the data in Github LFS (docs.streamlit.io/streamlit-cloud/troubleshooting#how-do-i-store-files-locally) or somewhere in the Cloud like in Amazon S3 or even Google Drive and then download/cache it at the beginning of your script with a Python library.
      Have a nice day!

  • @anicetcyrillekambou4366
    @anicetcyrillekambou4366 Рік тому

    I Fanilo Andrianasolo. I love your videos. I'm every time learning new things about streamlit on your chanel. I need your help with something, the way you do to avoid reloading effect on you streamlit app. How you do that ?

    • @anicetcyrillekambou4366
      @anicetcyrillekambou4366 Рік тому

      I found an answer on this video ua-cam.com/video/0mFwVBVu21c/v-deo.html

    • @andfanilo
      @andfanilo  Рік тому +1

      Hey! I'm not sure I understand, are you talking about the whole reloading effect every time you interact with a widget?
      (if that's the case then no, you can't avoid it, but you can, through the usage of st.experimental_memo avoid the reloading of a complex function, and with session_state save results you want to preserve between reruns)
      Have a nice day!

    • @anicetcyrillekambou4366
      @anicetcyrillekambou4366 Рік тому +1

      Thanks @@andfanilo for your help. I tried experimental_memo and --runner.fastReruns true. It works. My app is more speed now and the reloading effect is almost invisible 🙏🏽

  • @akshanshkmr
    @akshanshkmr Рік тому

    I’d like to take credit for the cards😂. JK
    Great work Fanilo

    • @andfanilo
      @andfanilo  Рік тому +1

      I just remembered your st-card component this morning while looking inside the Components Tracker 🙃 I'll forever remember you as the origin story of the st-card eheh
      Hope you're doing well, and thanks for watching 🙂

  • @tamilil-1857
    @tamilil-1857 4 місяці тому

    Hey .. can you make a playlist of Chainlit ??

    • @andfanilo
      @andfanilo  4 місяці тому +1

      It's in my very long todo list of videos to make. Wait & see if that happens eventually :) thanks for sharing!

    • @tamilil-1857
      @tamilil-1857 4 місяці тому

      @@andfanilo thanks with love

  • @mouhameddiop2245
    @mouhameddiop2245 Рік тому

    if you can to do a lesson on how to create navbar with sub navbar

    • @andfanilo
      @andfanilo  Рік тому

      Maybe github.com/blackary/st_pages would work for you? 😊 haven’t tested it yet so if you test it, I’d love to hear your feedback on the package!

    • @mouhameddiop2245
      @mouhameddiop2245 Рік тому

      @@andfanilo thank you , i will test it and give you my feedback.

    • @mouhameddiop2245
      @mouhameddiop2245 Рік тому

      @@andfanilo i try to install it by pip install st-pages but i have an issue : ERROR: Could not find a version that satisfies the requirement st-pages
      ERROR: No matching distribution found for st-pages

  • @tylerjrichards_ds
    @tylerjrichards_ds Рік тому

    Hahahaha yes vertical space IS just a loop of st.write, I just got tired of writing the same thing over and over!

    • @andfanilo
      @andfanilo  Рік тому

      Well that’s how the greatest hacks are made right 😁? I have the same feeling when I add a blank column to create a bigger horizontal gap ahah

  • @ThinAirElon
    @ThinAirElon Рік тому

    let me help you out .... dont try to be witty every 3 secs its overwhelming viewers ... although its good to have ....its been overloaded .

    • @andfanilo
      @andfanilo  Рік тому

      Sorry to hear you had a mediocre viewing experience.
      Hopefully you'll find other UA-camrs that share similar info but in a delivery style you prefer.
      I won't be changing anything in my style, (and this video being one of my highest performing in views and retention tells me I should keep doing it this way), will keep refining it with your words in mind, I'm still learning :)

    • @ThinAirElon
      @ThinAirElon Рік тому

      @@andfanilo believe me content is super just need to fine tune little bit like more video time and content and little bit less on wittyness. I know these videos has more views but you can exponentially grow it more