python - 有没有办法删除最新版本的streamlit中包含文件名的侧面导航栏?

标签 python streamlit

我最近将 Streamlit 升级到版本 1.10.0。升级后,我运行streamlit,却发现有一个侧面导航栏,显示目录中存在的python 文件名。我已附上相同的图像。

import streamlit as st
import pandas as pd
from services.multiapp import MultiApp
from functools import partial
from pages import show, analysis, help, custom, download, three_d


def refresh():
    pass


file = st.file_uploader('Upload CSV file',
                        type='csv', help="Format")
if file is not None:
    # verification
    # Prediction
    st.button("Refresh", on_click=refresh)
    data = pd.read_csv(file)
    app = MultiApp()
    app.add_app('Show data', partial(show.app, data))
    app.add_app('Analysis', analysis.app)
    app.add_app('Custom Plots', custom.app)
    app.add_app('3-D Plots', partial(three_d.app, data))
    app.add_app('Download', partial(download.app, data, file.name))
    app.add_app('Help', help.app)
    app.run()

enter image description here

请帮我删除侧面导航栏。

我当前的工作目录具有以下结构

├── app.py
├── pages
│   ├── analysis.py
│   ├── custom.py
│   ├── download.py
│   ├── help.py
│   ├── __pycache__
│   │   ├── analysis.cpython-38.pyc
│   │   ├── analysis.cpython-39.pyc
│   │   ├── custom.cpython-38.pyc
│   │   ├── custom.cpython-39.pyc
│   │   ├── download.cpython-38.pyc
│   │   ├── download.cpython-39.pyc
│   │   ├── get_df.cpython-38.pyc
│   │   ├── help.cpython-38.pyc
│   │   ├── help.cpython-39.pyc
│   │   ├── iplots.cpython-38.pyc
│   │   ├── plot.cpython-38.pyc
│   │   ├── show.cpython-38.pyc
│   │   ├── show.cpython-39.pyc
│   │   ├── show_d.cpython-38.pyc
│   │   ├── three_d.cpython-38.pyc
│   │   └── three_d.cpython-39.pyc
│   ├── show.py
│   └── three_d.py
├── __pycache__
│   ├── multiapp.cpython-38.pyc
│   └── plots.cpython-38.pyc
├── README.md
├── services
│   ├── multiapp.py
│   ├── __pycache__
│   │   ├── multiapp.cpython-38.pyc
│   │   └── multiapp.cpython-39.pyc
│   └── services.py
├── Templates
│   ├── links.txt
│   ├── multi-page-app-main
│   │   ├── app.py
│   │   ├── apps
│   │   │   ├── data.py
│   │   │   ├── home.py
│   │   │   ├── model.py
│   │   │   └── __pycache__
│   │   │       ├── data.cpython-38.pyc
│   │   │       ├── home.cpython-38.pyc
│   │   │       └── model.cpython-38.pyc
│   │   ├── multiapp.py
│   │   ├── __pycache__
│   │   │   └── multiapp.cpython-38.pyc
│   │   ├── README.md
│   │   └── requirements.txt
│   ├── streamlit-dashboard-template-main
│   │   ├── app.py
│   │   ├── dashboard.py
│   │   ├── README.md
│   │   ├── stdashdark.png
│   │   └── stdashlight.png
│   ├── streamlit-geospatial-master
│   │   ├── app.py
│   │   ├── apps
│   │   │   ├── basemaps.py
│   │   │   ├── census.py
│   │   │   ├── cesium.py
│   │   │   ├── deck.py
│   │   │   ├── device_loc.py
│   │   │   ├── gee_datasets.py
│   │   │   ├── gee.py
│   │   │   ├── heatmap.py
│   │   │   ├── home.py
│   │   │   ├── housing.py
│   │   │   ├── plotly_maps.py
│   │   │   ├── raster.py
│   │   │   ├── rois.py
│   │   │   ├── timelapse.py
│   │   │   ├── vector.py
│   │   │   ├── wms.py
│   │   │   └── xy.py
│   │   ├── data
│   │   │   ├── cog_files.txt
│   │   │   ├── html
│   │   │   │   └── sfo_buildings.html
│   │   │   ├── realtor_data_dict.csv
│   │   │   ├── us_counties.geojson
│   │   │   ├── us_metro_areas.geojson
│   │   │   ├── us_nation.geojson
│   │   │   └── us_states.geojson
│   │   ├── environment-bk.yml
│   │   ├── index.html
│   │   ├── LICENSE
│   │   ├── multiapp.py
│   │   ├── packages.txt
│   │   ├── Procfile
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   └── setup.sh
│   ├── Streamlit-master
│   │   ├── app.py
│   │   ├── data
│   │   │   ├── demo.wav
│   │   │   ├── Salary_Data.csv
│   │   │   ├── sal.jpg
│   │   │   ├── snippets
│   │   │   └── virtual.mp4
│   │   ├── data.py
│   │   ├── demo.py
│   │   ├── layout.py
│   │   ├── plots.py
│   │   ├── Procfile
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   ├── sidebar.py
│   │   └── widget.py
│   └── streamlit template
│       ├── JC-202103-citibike-tripdata.csv
│       ├── logo.png
│       ├── requirements.txt
│       └── streamlit_template.py
├── test.csv
└── test.py

最佳答案

Streamlit 侧边栏选取位于“pages”文件夹中的所有内容(请参阅此处:Blog Streamlit)

您可以将您的pages文件夹重命名为其他名称,或者如果您喜欢侧边栏,则可以先将其折叠起来:

import streamlit as st
st.set_page_config(initial_sidebar_state="collapsed")

这样侧边栏将在启动时关闭,但如果需要仍然可以打开。

关于python - 有没有办法删除最新版本的streamlit中包含文件名的侧面导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72543675/

相关文章:

python - 如何抓取付费专区后面的网站

python - Django Rest Framework - 如何在 ModelSerializer 中添加自定义字段

python - 如何处理 Pyodide/STLite 中的请求?

python - 如何使按钮居中并着色

javascript - 在 Streamlit 上集成 js 脚本

python - 如何以随机度数旋转 Torch 张量

python - 如何从 Python 脚本捕获 Python 解释器和/或 CMD.EXE 输出?

python - 在数组中定义多个绘图对象并在 matplotlib 动画中更新

python - 如何在 Streamlit 上使用 Altair 绘制多个 Y 轴?

python - 从 Streamlit 下载 python-pptx