streamlit-timeline icon indicating copy to clipboard operation
streamlit-timeline copied to clipboard

A request to use local images in the Timeline component

Open SynchronyML opened this issue 2 years ago • 2 comments

Thanks a lot for the component, it helps me a lot to show my work, but I still have a need. For some reasons, I can only display some images locally, and I want to load them in the timeline. However, limited by technology, according to the example.json file you provided, I have seen the method of importing images by url, but I have not seen the strategy of localization import. Please guide me.

   "title": {
        "media": {
          "url": "",
          "caption": " <a target=\"_blank\" href=''>credits</a>",
          "credit": ""
        },
        "text": {
          "headline": "Welcome to<br>TastePeptides-Meta",
          "text": "<p>A Timeline showcasing the development process of TastePeptides-Meta</p>"
        }
    },

SynchronyML avatar Jun 11 '23 04:06 SynchronyML

Try this: https://docs.streamlit.io/develop/concepts/configuration/serving-static-files After enabling static file serving as described, you can serve local images in your example as follows: "url": "app/static/your_img.jpg"

ajhiggins96 avatar Apr 29 '24 22:04 ajhiggins96

Maybe I didn’t express myself clearly before. I want to make modifications within the JSON to achieve the masking function. Now I have the following code, but the recognition fails.

 {
    "media": {
      "url": "statics/0-MyWeb/2-Timeline/6-SARS-Cov2.jpg"
    },

f it’s convenient for you, could you please provide sample code for referencing local files within a JSON file? Thank you!

SynchronyML avatar Mar 08 '25 06:03 SynchronyML