osbm commited on
Commit
5f0893b
·
1 Parent(s): 7c01f0b

add uuid parameter to update_vote function and update related logic

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -68,6 +68,7 @@ def update_vote(
68
  healthiness: int,
69
  fat_level: int,
70
  muscle_level: int,
 
71
  ):
72
  url = f"https://huggingface.co/datasets/aifred-smart-life-coach/labels/raw/main/{voter}.csv"
73
 
@@ -92,11 +93,12 @@ def update_vote(
92
  {
93
  "image_path": [image],
94
  "gender": [ gender ],
95
- "healthiness": [healthiness],
96
  "fat_level": [fat_level],
97
  "muscle_level": [muscle_level],
98
  "vote_date": [int(time.time())],
99
  "voter_name": [voter],
 
100
  }
101
  )
102
 
@@ -111,6 +113,11 @@ def update_vote(
111
  commit_message=f"{voter} voted for {image}"
112
  )
113
 
 
 
 
 
 
114
  if 'loggedin' not in st.session_state:
115
  st.session_state['loggedin'] = 'false'
116
 
@@ -128,9 +135,10 @@ if submitted or st.session_state['loggedin'] == 'true':
128
  st.write("You are now logged in")
129
  st.session_state['loggedin'] = 'true'
130
 
 
131
 
132
  with st.form("images", clear_on_submit=True):
133
- image_path = get_one_from_queue(username)
134
  if not image_path:
135
  st.write("You have voted for all the images")
136
  st.stop()
@@ -160,7 +168,8 @@ if submitted or st.session_state['loggedin'] == 'true':
160
  gender=gender,
161
  healthiness=healthiness,
162
  fat_level=fat_level,
163
- muscle_level=muscle_level
 
164
  )
165
  st.write(f"Vote submitted uuid: {uuid_num} (in case you want to undo the vote)")
166
  # push the data to the database
 
68
  healthiness: int,
69
  fat_level: int,
70
  muscle_level: int,
71
+ uuid_num: str,
72
  ):
73
  url = f"https://huggingface.co/datasets/aifred-smart-life-coach/labels/raw/main/{voter}.csv"
74
 
 
93
  {
94
  "image_path": [image],
95
  "gender": [ gender ],
96
+ "health": [healthiness],
97
  "fat_level": [fat_level],
98
  "muscle_level": [muscle_level],
99
  "vote_date": [int(time.time())],
100
  "voter_name": [voter],
101
+ "uuid": [uuid_num],
102
  }
103
  )
104
 
 
113
  commit_message=f"{voter} voted for {image}"
114
  )
115
 
116
+
117
+
118
+
119
+
120
+
121
  if 'loggedin' not in st.session_state:
122
  st.session_state['loggedin'] = 'false'
123
 
 
135
  st.write("You are now logged in")
136
  st.session_state['loggedin'] = 'true'
137
 
138
+ image_path = get_one_from_queue(username)
139
 
140
  with st.form("images", clear_on_submit=True):
141
+
142
  if not image_path:
143
  st.write("You have voted for all the images")
144
  st.stop()
 
168
  gender=gender,
169
  healthiness=healthiness,
170
  fat_level=fat_level,
171
+ muscle_level=muscle_level,
172
+ uuid_num=uuid_num,
173
  )
174
  st.write(f"Vote submitted uuid: {uuid_num} (in case you want to undo the vote)")
175
  # push the data to the database