Lashtw commited on
Commit
8d8bfbb
ยท
verified ยท
1 Parent(s): 7fbc8d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -144,18 +144,30 @@ def main():
144
  st.plotly_chart(fig, use_container_width=True)
145
  except Exception as e:
146
  st.error(f"็”Ÿๆˆ้›ท้”ๅœ–ๆ™‚็™ผ็”Ÿ้Œฏ่ชค๏ผš{e}")
147
-
148
  st.write("### ๆ‰นๆฌก็นช่ฃฝๅ€‹ๅˆฅๅญธ็”Ÿๆฏ”่ผƒๅœ–")
149
 
150
  individual_students = st.multiselect("้ธๆ“‡่ฆๅ€‹ๅˆฅๆฏ”่ผƒ็š„ๅญธ็”Ÿ", df['ๅง“ๅ'].tolist(), key = "student")
151
  comparison_items = st.multiselect("้ธๆ“‡่ฆๆฏ”่ผƒ็š„้ …็›ฎ", df['ๅง“ๅ'].tolist(), key = "item")
152
 
153
  if individual_students and comparison_items:
154
- for student in individual_students:
155
- fig = create_radar_chart(df, [student] + comparison_items, selected_columns)
156
- st.image(create_composite_image(fig,student), use_column_width=True)
157
- st.text(f"{student} ่ˆ‡ {', '.join(comparison_items)} ็š„ๆฏ”่ผƒ")
158
-
 
 
 
 
 
 
 
 
 
 
 
 
159
  if __name__ == "__main__":
160
  import numpy as np
161
  main()
 
144
  st.plotly_chart(fig, use_container_width=True)
145
  except Exception as e:
146
  st.error(f"็”Ÿๆˆ้›ท้”ๅœ–ๆ™‚็™ผ็”Ÿ้Œฏ่ชค๏ผš{e}")
147
+
148
  st.write("### ๆ‰นๆฌก็นช่ฃฝๅ€‹ๅˆฅๅญธ็”Ÿๆฏ”่ผƒๅœ–")
149
 
150
  individual_students = st.multiselect("้ธๆ“‡่ฆๅ€‹ๅˆฅๆฏ”่ผƒ็š„ๅญธ็”Ÿ", df['ๅง“ๅ'].tolist(), key = "student")
151
  comparison_items = st.multiselect("้ธๆ“‡่ฆๆฏ”่ผƒ็š„้ …็›ฎ", df['ๅง“ๅ'].tolist(), key = "item")
152
 
153
  if individual_students and comparison_items:
154
+
155
+ image_options = []
156
+ image_bytes = {}
157
+ for student in individual_students:
158
+ fig = create_radar_chart(df, [student] + comparison_items, selected_columns)
159
+ image_bytes[student] = create_composite_image(fig,student)
160
+ image_options.append(f"{student} ่ˆ‡ {', '.join(comparison_items)} ็š„ๆฏ”่ผƒ")
161
+
162
+ selected_image_options = st.multiselect("้ธๆ“‡่ฆ้กฏ็คบ็š„ๅœ–็‰‡", options=image_options)
163
+
164
+ cols = st.columns(3) # ๆŽ’ๆˆไธ‰ๅˆ—
165
+ for i, option in enumerate(selected_image_options):
166
+ student = option.split(" ่ˆ‡ ")[0]
167
+ with cols[i%3]:
168
+ st.image(image_bytes[student], use_container_width=True)
169
+ st.text(option)
170
+
171
  if __name__ == "__main__":
172
  import numpy as np
173
  main()