kambris commited on
Commit
e5c945e
·
verified ·
1 Parent(s): 7e0131c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py CHANGED
@@ -438,3 +438,42 @@ if uploaded_file is not None:
438
  if line_info:
439
  st.write(f"Folio: {line_info['folio']}, Par: {line_info['par']}, Line: {line_info['line']}")
440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  if line_info:
439
  st.write(f"Folio: {line_info['folio']}, Par: {line_info['par']}, Line: {line_info['line']}")
440
 
441
+ # Add this after the current word viewer
442
+ st.subheader("Current Line View")
443
+
444
+ if filtered_words:
445
+ current_line_info = line_info
446
+ current_line_words = []
447
+
448
+ # Get all words from the current line
449
+ for word_data in word_positions:
450
+ if (word_data['folio'] == current_line_info['folio'] and
451
+ word_data['par'] == current_line_info['par'] and
452
+ word_data['line'] == current_line_info['line']):
453
+ current_line_words = word_data['words']
454
+ break
455
+
456
+ # Display each word in the line with its slot sequence
457
+ st.write(f"Line {current_line_info['line']} in Paragraph {current_line_info['par']}")
458
+
459
+ for word, _, chars in current_line_words:
460
+ st.write(f"Word: {word}")
461
+ word_cols = st.columns(12)
462
+ for i in range(12):
463
+ with word_cols[i]:
464
+ char = chars[i] if i < len(chars) else ""
465
+ st.markdown(f"""
466
+ <div style='
467
+ width: 40px;
468
+ height: 40px;
469
+ border: 2px solid #ccc;
470
+ display: flex;
471
+ align-items: center;
472
+ justify-content: center;
473
+ font-size: 20px;
474
+ background-color: {"#e6f3ff" if char else "white"};
475
+ margin: 2px;
476
+ '>
477
+ {char}
478
+ </div>
479
+ """, unsafe_allow_html=True)