20
loading...
This website collects cookies to deliver better user experience
3.7.2
, but it is actually 3.6.10
known from sys.version
at least in the asia-northeast1
zone (Tokyo).st.file_uploader
or st.download_button
, you should set the maximum number of instances to 1. For that configuration, see https://cloud.google.com/appengine/docs/flexible/python/reference/app-yaml#services.socket.io
as documented though this problem is due to a different reason.$ gcloud app deploy
.
├── app.yaml
├── requirements.txt
└── streamlit-app.py
runtime: python
env: flex
runtime_config:
python_version: 3
entrypoint: streamlit run streamlit-app.py --server.port $PORT
entrypoint
is configured to run the Streamlit process with the specified port number via the $PORT
environment variable.
streamlit~=1.2.0
import streamlit as st
st.title("App Engine sample app")
name = st.text_input("Your name?")
st.write(f"Hello, {name or 'world'}!")
.
├── app.yaml
├── requirements.txt
└── streamlit-app.py
runtime: python
env: flex
runtime_config:
python_version: 3
entrypoint: streamlit run streamlit-app.py --server.port $PORT
automatic_scaling:
max_num_instances: 1
# Or manual scaling as below:
# manual_scaling:
# instances: 1
automatic_scaling.max_num_instances
is set to 1
.manual_scaling.instances
instead.streamlit~=1.2.0
import streamlit as st
st.title("App Engine sample app")
uploaded_file = st.file_uploader("Upload some file")
if uploaded_file:
st.write(f"{uploaded_file.name} was uploaded.")
st.download_button(f"Download {uploaded_file.name}", data=uploaded_file, file_name=uploaded_file.name)
Dockerfile
..
├── Dockerfile
├── app.yaml
├── requirements.txt
└── streamlit-app.py
runtime: custom
env: flex
runtime: custom
to use a custom runtime.entrypoint
is not needed as it is defined in Dockerfile
.FROM gcr.io/google-appengine/python
# Ref:
# * https://github.com/GoogleCloudPlatform/python-runtime/blob/8cdc91a88cd67501ee5190c934c786a7e91e13f1/README.md#kubernetes-engine--other-docker-hosts
# * https://github.com/GoogleCloudPlatform/python-runtime/blob/8cdc91a88cd67501ee5190c934c786a7e91e13f1/scripts/testdata/hello_world_golden/Dockerfile
RUN virtualenv /env -p python3.7
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
ADD requirements.txt /app/
RUN pip install -r requirements.txt
ADD . /app
ENTRYPOINT [ "streamlit", "run", "streamlit-app.py", "--server.port", "8080" ]
gcr.io/google-appengine/python
.
Dockerfile
s of the test data in that repository can be referencesstreamlit~=1.2.0
import sys
import streamlit as st
st.write(sys.version)