parvalijaved commited on
Commit
0e6cba1
·
verified ·
1 Parent(s): e18eb1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -37,17 +37,27 @@ if chapter_details:
37
  # Extract verses for the selected chapter if available
38
  verses = chapter_details.get('verses')
39
  if isinstance(verses, list) and verses:
40
- verses_dict = {verse['verse_number']: verse for verse in verses}
 
 
 
 
 
 
 
 
 
 
41
 
42
  # Select Verse
43
- verse_number = st.selectbox("Select Verse", sorted(verses_dict.keys()))
44
 
45
  # Display selected verse
46
- selected_verse = verses_dict.get(verse_number)
47
  if selected_verse:
48
- st.markdown(f"**Verse {verse_number}**")
49
  st.markdown(f"**Sanskrit:**\n\n{selected_verse['text']}")
50
- st.markdown(f"**Translation:**\n\n{selected_verse['translation']}")
51
  else:
52
  st.error("Verse details not found.")
53
  else:
 
37
  # Extract verses for the selected chapter if available
38
  verses = chapter_details.get('verses')
39
  if isinstance(verses, list) and verses:
40
+ # Display all verses in the selected chapter
41
+ st.subheader("All Verses in this Chapter")
42
+ for verse in verses:
43
+ verse_number = verse['verse_number']
44
+ verse_text = verse['text']
45
+ verse_translation = verse['word_meanings']
46
+
47
+ st.markdown(f"**Verse {verse_number}**")
48
+ st.markdown(f"**Sanskrit:** {verse_text}")
49
+ st.markdown(f"**Translation:** {verse_translation}")
50
+ st.markdown("---")
51
 
52
  # Select Verse
53
+ verse_number = st.selectbox("Select Verse", [verse['verse_number'] for verse in verses])
54
 
55
  # Display selected verse
56
+ selected_verse = next((verse for verse in verses if verse['verse_number'] == verse_number), None)
57
  if selected_verse:
58
+ st.markdown(f"**Verse {selected_verse['verse_number']}**")
59
  st.markdown(f"**Sanskrit:**\n\n{selected_verse['text']}")
60
+ st.markdown(f"**Translation:**\n\n{selected_verse['word_meanings']}")
61
  else:
62
  st.error("Verse details not found.")
63
  else: