Circularmachines commited on
Commit
8cc7c1a
·
1 Parent(s): 6e07b6f

app.py updates

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -3,6 +3,7 @@ from PIL import Image, ImageDraw
3
 
4
  from streamlit_image_coordinates import streamlit_image_coordinates
5
 
 
6
 
7
  from datasets import load_dataset
8
 
@@ -13,11 +14,11 @@ ds = load_dataset("Circularmachines/batch_indexing_machine_100_small_imgs", spli
13
 
14
 
15
 
16
- st.set_page_config(
17
- page_title="Streamlit Image Coordinates: Image Update",
18
- page_icon="🎯",
19
- layout="wide",
20
- )
21
 
22
  #"# :dart: Streamlit Image Coordinates: Image Update"
23
 
@@ -27,8 +28,11 @@ if "points" not in st.session_state:
27
 
28
  #"## Click on image"
29
 
 
 
30
 
31
- with ds[0]['image'] as img:
 
32
  draw = ImageDraw.Draw(img)
33
 
34
  def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
@@ -57,7 +61,9 @@ with ds[0]['image'] as img:
57
  st.experimental_rerun()
58
 
59
 
60
- if st.button('Say hello'):
61
- st.write('Why hello there')
62
- else:
63
- st.write('Gohuhuhubye')
 
 
 
3
 
4
  from streamlit_image_coordinates import streamlit_image_coordinates
5
 
6
+ import numpy as np
7
 
8
  from datasets import load_dataset
9
 
 
14
 
15
 
16
 
17
+ #st.set_page_config(
18
+ # page_title="Streamlit Image Coordinates: Image Update",
19
+ # page_icon="🎯",
20
+ # layout="wide",
21
+ #)
22
 
23
  #"# :dart: Streamlit Image Coordinates: Image Update"
24
 
 
28
 
29
  #"## Click on image"
30
 
31
+ r=np.random.randint(5000)
32
+ current_image=ds[r]['image']
33
 
34
+
35
+ with current_image as img:
36
  draw = ImageDraw.Draw(img)
37
 
38
  def get_ellipse_coords(point):# tuple[int, int]) -> tuple[int, int, int, int]):
 
61
  st.experimental_rerun()
62
 
63
 
64
+ if st.button('Random frame'):
65
+ r=np.random.randint(5000)
66
+ current_image=ds[r]['image']
67
+ st.write(str(r))
68
+ #else:
69
+ # st.write('Gohuhuhubye')