Download App.py from mohsin06/Smartsite: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/mohsin06/Smartsite/resolve/main/App.py
- Command line
-
hf download hf://spaces/mohsin06/Smartsite/App.py
-
curl -L -o App.py https://huggingface.co/spaces/mohsin06/Smartsite/resolve/main/App.py
1.26 kB
| import streamlit as st | |
| # Title and description | |
| st.title("SmartSite Application") | |
| st.write("Welcome to the Streamlit SmartSite application deployed on Hugging Face Spaces!") | |
| # User input section | |
| st.sidebar.header("User Input") | |
| user_name = st.sidebar.text_input("Enter your name", "Guest") | |
| # Display user name | |
| st.subheader(f"Hello, {user_name}!") | |
| # Feature example: Simple calculator | |
| st.write("### Simple Calculator") | |
| num1 = st.number_input("Enter first number", 0) | |
| num2 = st.number_input("Enter second number", 0) | |
| operation = st.selectbox("Choose an operation", ["Add", "Subtract", "Multiply", "Divide"]) | |
| if st.button("Calculate"): | |
| if operation == "Add": | |
| result = num1 + num2 | |
| elif operation == "Subtract": | |
| result = num1 - num2 | |
| elif operation == "Multiply": | |
| result = num1 * num2 | |
| elif operation == "Divide": | |
| result = num1 / num2 if num2 != 0 else "Error: Division by zero" | |
| st.write(f"Result: {result}") | |
| # Additional feature: Upload and display file | |
| st.write("### File Upload") | |
| uploaded_file = st.file_uploader("Upload a file") | |
| if uploaded_file: | |
| st.write("Uploaded File Content:") | |
| st.write(uploaded_file.getvalue().decode("utf-8")) | |
| st.write("Thank you for using the SmartSite application!") | |