eaglelandsonce commited on
Commit
fc4aeac
·
verified ·
1 Parent(s): 02a2ae0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -37
app.py CHANGED
@@ -1,42 +1,13 @@
1
  import streamlit as st
2
- from PIL import Image
3
 
4
- # Placeholder image setup
5
- placeholder_images = [
6
- Image.open('data/image1.jpg'), # Replace 'image1.jpg' with your placeholder image paths
7
- Image.open('data/image2.jpg'),
8
- Image.open('data/image3.jpg'),
9
- Image.open('data/image4.jpg'),
10
- Image.open('data/image5.jpg')
11
- ]
12
 
13
- def rearrange(order):
14
- dynamic_container = st.container()
15
 
16
- new_image_order = [placeholder_images[int(o) - 1] for o in order if o.isdigit() and 0 < int(o) <= len(placeholder_images)]
17
- new_input_order = [st.session_state.get(f"input_{o}", "") for o in order if o.isdigit() and 0 < int(o) <= len(placeholder_images)]
18
- new_output_order = [st.session_state.get(f"output_{o}", "") for o in order if o.isdigit() and 0 < int(o) <= len(placeholder_images)]
19
 
20
- # Update display
21
- for i, o in enumerate(order):
22
- if o.isdigit() and 0 < int(o) <= len(placeholder_images):
23
- cols = dynamic_container.columns(3)
24
- cols[0].image(new_image_order[i], width=100)
25
- input_key = f"input_{o}_{i}" # Ensure unique key by including both order and index
26
- output_key = f"output_{o}_{i}" # Ensure unique key by including both order and index
27
- cols[1].text_input(f"Input {o}", value=new_input_order[i], key=input_key)
28
- cols[2].text_area(f"Output {o}", value=new_output_order[i], height=100, key=output_key)
29
-
30
- st.title("Image Rearrangement App")
31
-
32
- # Overall Input
33
- order = st.text_input("Enter image order (e.g., 12345, 112, 54321)", key="order_input")
34
-
35
- # Validate order input
36
- valid_order = order and all(o.isdigit() and 0 < int(o) <= len(placeholder_images) for o in order)
37
-
38
- if valid_order:
39
- # Call the rearrange function when data is present and valid
40
- rearrange(order)
41
- else:
42
- st.error("Please enter a valid order using numbers 1-5, which can be repeated or less than 5 characters long.")
 
1
  import streamlit as st
 
2
 
3
+ # Set page title and layout
4
+ st.set_page_config(page_title="Concept Review", layout="wide")
 
 
 
 
 
 
5
 
6
+ # Display the page title
7
+ st.title("Concept Review")
8
 
9
+ # The URL of the YouTube video you want to embed
10
+ video_url = "https://www.youtube.com/watch?v=c4TOr1sJiCk" # Replace with the actual URL of your video
 
11
 
12
+ # Embed the YouTube video
13
+ st.video(video_url)