Tzetha commited on
Commit
10f3c8b
·
1 Parent(s): 780f02f
Files changed (1) hide show
  1. app.py +35 -5
app.py CHANGED
@@ -1,8 +1,38 @@
1
  import streamlit as st
2
 
3
- st.title("Hugging Face + Streamlit Demo")
4
- st.write("This is a demo Streamlit app for my Hugging Face repo!")
5
 
6
- # Example interactive widget
7
- user_input = st.text_input("Enter some text")
8
- st.write(f"You entered: {user_input}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ # App Title
4
+ st.title("Color color sa box")
5
 
6
+ # Sliders for RGB values
7
+ st.sidebar.header("Adjust Box Color")
8
+ r = st.sidebar.slider("Red", 0, 255, 128, step=1)
9
+ g = st.sidebar.slider("Green", 0, 255, 128, step=1)
10
+ b = st.sidebar.slider("Blue", 0, 255, 128, step=1)
11
+
12
+ # Slider for darkness/shade
13
+ shade = st.sidebar.slider("Shade (0: Dark, 1: Light)", 0.0, 1.0, 0.5, step=0.01)
14
+
15
+ # Calculate the adjusted RGB values based on shade
16
+ adjusted_r = int(r * shade)
17
+ adjusted_g = int(g * shade)
18
+ adjusted_b = int(b * shade)
19
+
20
+ # Display the box with adjusted color
21
+ box_color = f"rgb({adjusted_r}, {adjusted_g}, {adjusted_b})"
22
+ st.markdown(
23
+ f"""
24
+ <div style="
25
+ width: 200px;
26
+ height: 200px;
27
+ background-color: {box_color};
28
+ border: 1px solid black;">
29
+ </div>
30
+ """,
31
+ unsafe_allow_html=True
32
+ )
33
+
34
+ # Show the current RGB values
35
+ st.write("**Adjusted RGB Values:**")
36
+ st.write(f"Red: {adjusted_r}, Green: {adjusted_g}, Blue: {adjusted_b}")
37
+
38
+ st.write("Use the sliders in the sidebar to adjust the color, shade, and darkness of the box.")