|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# [START cloudrun_helloworld_streamlit] |
| 16 | +import streamlit as st |
| 17 | + |
| 18 | +st.title(f"Hello World! 👋🌎") |
| 19 | +st.markdown( |
| 20 | + """ |
| 21 | + This is a demo Streamlit app. |
| 22 | +
|
| 23 | + Enter your name in the text box below and press a button to see some fun features in Streamlit. |
| 24 | + """ |
| 25 | +) |
| 26 | + |
| 27 | +name = st.text_input("Enter your name:") |
| 28 | + |
| 29 | +# Use columns to create buttons side by side |
| 30 | +col1, col2 = st.columns(2) |
| 31 | + |
| 32 | +with col1: |
| 33 | + if st.button("Send balloons! 🎈"): |
| 34 | + st.balloons() |
| 35 | + st.write(f"Time to celebrate {name}! 🥳") |
| 36 | + st.write("You deployed a Streamlit app! 👏") |
| 37 | + |
| 38 | +with col2: |
| 39 | + if st.button("Send snow! ❄️"): |
| 40 | + st.snow() |
| 41 | + st.write(f"Let it snow {name}! 🌨️") |
| 42 | + st.write("You deployed a Streamlit app! 👏") |
| 43 | +# [END cloudrun_helloworld_streamlit] |
0 commit comments