This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| from PIL import Image | |
| import tensorflow as tf | |
| import numpy as np | |
| # Load pre-trained MobileNetV2 model | |
| @st.cache_resource | |
| def load_model(): | |
| model = tf.keras.applications.MobileNetV2(weights='imagenet') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| data = pd.DataFrame( | |
| np.random.randn(50, 3), | |
| columns=["X", "Y", "Z"] | |
| ) | |
| st.line_chart(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| data = pd.DataFrame( | |
| np.random.randint(1, 100, size=(10, 3)), | |
| columns=["A", "B", "C"] | |
| ) | |
| st.bar_chart(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| import streamlit as st | |
| # Load and display an image | |
| image = Image.open("images/example.jpg") # Replace with your image file | |
| st.image(image, caption="Sample Image", use_container_width=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| import streamlit as st | |
| # Load and display an image | |
| image = Image.open("images/example.jpg") # Replace with your image file | |
| st.image(image, caption="Sample Image", use_container_width=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| # Add a checkbox | |
| if st.checkbox("Show a random data table"): | |
| data = pd.DataFrame( | |
| np.random.randn(10, 5), | |
| columns=["A", "B", "C", "D", "E"] | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| # Title of the app | |
| st.title("Welcome to My First Streamlit App 🎉") | |
| # Input box for user name | |
| name = st.text_input("What's your name?") | |
| # Display a personalized greeting | |
| if name: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import random | |
| import string | |
| import time | |
| # Function to generate random strings for names and screen names | |
| def random_string(length=10): | |
| return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) |
NewerOlder