whitphx HF staff commited on
Commit
e79347e
1 Parent(s): 7901a5c

Add responsive examples

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +37 -15
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🐢
4
  colorFrom: red
5
  colorTo: yellow
6
  sdk: streamlit
7
- sdk_version: 1.17.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: red
5
  colorTo: yellow
6
  sdk: streamlit
7
+ sdk_version: 1.18.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -1,24 +1,46 @@
 
1
  import streamlit as st
2
- from streamlit_webrtc import webrtc_streamer
3
- import av
4
 
5
 
6
- flip = st.checkbox("Flip")
 
7
 
 
 
 
 
8
 
9
- def video_frame_callback(frame):
10
- img = frame.to_ndarray(format="bgr24")
 
 
11
 
12
- flipped = img[::-1,:,:] if flip else img
13
 
14
- return av.VideoFrame.from_ndarray(flipped, format="bgr24")
 
15
 
 
 
16
 
17
- webrtc_streamer(
18
- key="sample",
19
- video_frame_callback=video_frame_callback,
20
- media_stream_constraints={"video": True, "audio": False},
21
- rtc_configuration={ # Add this config
22
- "iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]
23
- }
24
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime, time
2
  import streamlit as st
 
 
3
 
4
 
5
+ st.title("Streamlit App at Hugging Face Spaces!")
6
+ st.image("https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo-with-title.png")
7
 
8
+ with st.form("my_form"):
9
+ st.write("Inside the form")
10
+ slider_val = st.slider("Form slider")
11
+ checkbox_val = st.checkbox("Form checkbox")
12
 
13
+ # Every form must have a submit button.
14
+ submitted = st.form_submit_button("Submit")
15
+ if submitted:
16
+ st.write("slider", slider_val, "checkbox", checkbox_val)
17
 
18
+ col1, col2, col3 = st.columns(3)
19
 
20
+ with col1:
21
+ st.image("https://static.streamlit.io/examples/cat.jpg")
22
 
23
+ with col2:
24
+ st.image("https://static.streamlit.io/examples/dog.jpg")
25
 
26
+ with col3:
27
+ st.image("https://static.streamlit.io/examples/owl.jpg")
28
+
29
+ with st.sidebar:
30
+ st.image("https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png")
31
+
32
+ values = st.slider(
33
+ 'Select a range of values',
34
+ 0.0, 100.0, (25.0, 75.0))
35
+ st.write('Values:', values)
36
+
37
+ appointment = st.slider(
38
+ "Schedule your appointment:",
39
+ value=(time(11, 30), time(12, 45)))
40
+ st.write("You're scheduled for:", appointment)
41
+
42
+ start_time = st.slider(
43
+ "When do you start?",
44
+ value=datetime(2020, 1, 1, 9, 30),
45
+ format="MM/DD/YY - hh:mm")
46
+ st.write("Start time:", start_time)