10 extra Streamlit widgets you didn't know existed

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 46

  • @CodingIsFun
    @CodingIsFun Год назад +4

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

    • @andfanilo
      @andfanilo  Год назад +2

      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 Год назад +2

      @@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 😅

  • @simonecensuales640
    @simonecensuales640 Год назад +6

    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 ☺️

  • @ganeshsuresh4723
    @ganeshsuresh4723 Год назад +1

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

  • @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 »

  • @SantiagoEspinoza-ew4ku
    @SantiagoEspinoza-ew4ku 6 месяцев назад

    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  6 месяцев назад

      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  6 месяцев назад

      I have no clue if RUclips 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 6 месяцев назад

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

  • @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!

  • @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 ruclips.net/video/0mFwVBVu21c/видео.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 🙏🏽

  • @M1911Original
    @M1911Original Год назад

    Thanks man that was very useful ❤👍🏾👍🏾

    • @andfanilo
      @andfanilo  Год назад

      Thanks for the support 😊

  • @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

  • @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!

  • @tamilil-1857
    @tamilil-1857 8 месяцев назад

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

    • @andfanilo
      @andfanilo  8 месяцев назад +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 8 месяцев назад

      @@andfanilo thanks with love

  • @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 🙂

  • @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

  • @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

  • @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 RUclipsrs 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