Skip to content

Instantly share code, notes, and snippets.

View talaatmagdyx's full-sized avatar
🔧
code

TalaatMagdy talaatmagdyx

🔧
code
View GitHub Profile
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')
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)
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)
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)
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)
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"]
)
import streamlit as st
# Add a button
if st.button("Click Me!"):
st.write("You just clicked the button!")
import streamlit as st
# Add a dropdown menu
option = st.selectbox(
"What's your favorite programming language?",
["Python", "JavaScript", "C++", "Java"]
)
st.write(f"You selected: {option}")
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:
@talaatmagdyx
talaatmagdyx / generate_twitter_dm.py
Created September 26, 2024 12:18
Generate fake messages like twitter dm
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))