awacke1 commited on
Commit
182f76e
Β·
1 Parent(s): aee3d1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -41
app.py CHANGED
@@ -163,13 +163,20 @@ homunculus_parts = {
163
  "Left Shin": "🦡", "Right Shin": "🦡"
164
  }
165
 
166
- # Function to display the homunculus parts with expanders
 
167
  def display_homunculus_parts():
168
  st.title("Homunculus Model")
169
 
170
  # Container parts
171
  with st.expander("Head (🧠)", expanded=False):
172
  st.write("Contains: Left Eye πŸ‘οΈ, Right Eye πŸ‘οΈ, Left Eyebrow 🀨, Right Eyebrow 🀨, Nose πŸ‘ƒ, Mouth πŸ‘„")
 
 
 
 
 
 
173
 
174
  # Symmetric body parts (Left & Right)
175
  for part in ["Shoulder", "Upper Arm", "Elbow", "Forearm", "Wrist", "Hand", "Hip", "Thigh", "Knee", "Shin"]:
@@ -177,51 +184,27 @@ def display_homunculus_parts():
177
  with col1:
178
  with st.expander(f"Left {part} (πŸ’ͺ)", expanded=False):
179
  st.write(f"Details about the Left {part}")
 
 
 
 
180
  with col2:
181
  with st.expander(f"Right {part} (πŸ’ͺ)", expanded=False):
182
  st.write(f"Details about the Right {part}")
 
 
 
 
183
 
184
  # Central body parts
185
- for part in ["Neck", "Chest", "Abdomen", "Pelvis"]:
186
- with st.expander(f"{part} ({homunculus_parts[part]})", expanded=False):
 
187
  st.write(f"Details about the {part}")
188
-
189
-
190
- # Homunculus parts with emojis
191
- homunculus_parts2 = {
192
- "Head (H)": ["🧠", ["Left Eye (LE)", "Right Eye (RE)", "Left Eyebrow (LB)", "Right Eyebrow (RB)", "Nose (N)", "Mouth (M)"]],
193
- "Neck (Ne)": "🧣",
194
- "Shoulders": [["Left Shoulder (LS)", "Right Shoulder (RS)"], "πŸ’ͺ"],
195
- "Upper Arms": [["Left Upper Arm (LUA)", "Right Upper Arm (RUA)"], "πŸ’ͺ"],
196
- "Elbows": [["Left Elbow (LEl)", "Right Elbow (REl)"], "πŸ’ͺ"],
197
- "Forearms": [["Left Forearm (LF)", "Right Forearm (RF)"], "πŸ’ͺ"],
198
- "Wrists": [["Left Wrist (LW)", "Right Wrist (RW)"], "πŸ–οΈ"],
199
- "Hands": [["Left Hand (LH)", "Right Hand (RH)"], "🀚"],
200
- "Chest (C)": "🫁",
201
- "Abdomen (Ab)": "🧘",
202
- "Pelvis (P)": "🧍",
203
- "Hips": [["Left Hip (LHip)", "Right Hip (RHip)"], "🦡"],
204
- "Thighs": [["Left Thigh (LT)", "Right Thigh (RT)"], "🦡"],
205
- "Knees": [["Left Knee (LK)", "Right Knee (RK)"], "🦡"],
206
- "Shins": [["Left Shin (LSh)", "Right Shin (RSh)"], "🦡"]
207
- }
208
-
209
- def display_homunculus_parts2():
210
- st.title("Homunculus Model")
211
-
212
- for part, content in homunculus_parts2.items():
213
- if isinstance(content, list):
214
- emoji, sub_parts = content[0], content[1]
215
- with st.expander(f"{emoji} {part}", expanded=False):
216
- if isinstance(sub_parts, list):
217
- col1, col2 = st.columns(2)
218
- for subpart in sub_parts:
219
- col = col1 if "Left" in subpart else col2
220
- col.write(f"{homunculus_parts2.get(subpart, '❓')} {subpart}")
221
- else:
222
- st.write(f"{emoji} {sub_parts}")
223
- else:
224
- st.write(f"{content} {part}")
225
 
226
  # Define function to add paper buttons and links
227
  def add_paper_buttons_and_links():
@@ -231,7 +214,7 @@ def add_paper_buttons_and_links():
231
  if page == "Detailed Homunculus Model":
232
  display_homunculus_parts()
233
  elif page == "Homunculus Emoji Representation":
234
- display_homunculus_parts2()
235
 
236
  col1, col2, col3, col4 = st.columns(4)
237
 
 
163
  "Left Shin": "🦡", "Right Shin": "🦡"
164
  }
165
 
166
+
167
+ # Function to display the homunculus parts with expanders and chat buttons
168
  def display_homunculus_parts():
169
  st.title("Homunculus Model")
170
 
171
  # Container parts
172
  with st.expander("Head (🧠)", expanded=False):
173
  st.write("Contains: Left Eye πŸ‘οΈ, Right Eye πŸ‘οΈ, Left Eyebrow 🀨, Right Eyebrow 🀨, Nose πŸ‘ƒ, Mouth πŸ‘„")
174
+ head_parts = ["Left Eye", "Right Eye", "Left Eyebrow", "Right Eyebrow", "Nose", "Mouth"]
175
+ for part in head_parts:
176
+ prompt = f"Learn about the key features of {part}"
177
+ if st.button(f"Explore {part}", key=part):
178
+ response = chat_with_model(prompt, part)
179
+ st.write(response)
180
 
181
  # Symmetric body parts (Left & Right)
182
  for part in ["Shoulder", "Upper Arm", "Elbow", "Forearm", "Wrist", "Hand", "Hip", "Thigh", "Knee", "Shin"]:
 
184
  with col1:
185
  with st.expander(f"Left {part} (πŸ’ͺ)", expanded=False):
186
  st.write(f"Details about the Left {part}")
187
+ prompt = f"Learn about the key features of Left {part}"
188
+ if st.button(f"Explore Left {part}", key=f"Left {part}"):
189
+ response = chat_with_model(prompt, f"Left {part}")
190
+ st.write(response)
191
  with col2:
192
  with st.expander(f"Right {part} (πŸ’ͺ)", expanded=False):
193
  st.write(f"Details about the Right {part}")
194
+ prompt = f"Learn about the key features of Right {part}"
195
+ if st.button(f"Explore Right {part}", key=f"Right {part}"):
196
+ response = chat_with_model(prompt, f"Right {part}")
197
+ st.write(response)
198
 
199
  # Central body parts
200
+ central_parts = ["Neck", "Chest", "Abdomen", "Pelvis"]
201
+ for part in central_parts:
202
+ with st.expander(f"{part} ({homunculus_parts2[part][0]})", expanded=False):
203
  st.write(f"Details about the {part}")
204
+ prompt = f"Learn about the key features of {part}"
205
+ if st.button(f"Explore {part}", key=part):
206
+ response = chat_with_model(prompt, part)
207
+ st.write(response)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
  # Define function to add paper buttons and links
210
  def add_paper_buttons_and_links():
 
214
  if page == "Detailed Homunculus Model":
215
  display_homunculus_parts()
216
  elif page == "Homunculus Emoji Representation":
217
+ display_homunculus_parts()
218
 
219
  col1, col2, col3, col4 = st.columns(4)
220