Spaces:
Build error
Build error
| import subprocess | |
| import sys | |
| # Function to install a package using pip | |
| def install(package): | |
| subprocess.check_call([sys.executable, "-m", "pip", "install", package]) | |
| # Install Streamlit if it's not already installed | |
| try: | |
| import streamlit as st | |
| except ImportError: | |
| print("Streamlit is not installed. Installing now...") | |
| install("streamlit") | |
| import streamlit as st | |
| # Streamlit app code | |
| st.set_page_config(page_title="Hello World App") | |
| st.title("Hello, World!") | |
| st.write("This is a Streamlit app that says 'Hello, World!'.") | |
| # Add some interactivity (optional) | |
| user_name = st.text_input("Enter your name:") | |
| if user_name: | |
| st.write(f"Hello, {user_name}!") |