Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -551,6 +551,7 @@ with tabs[2]:
|
|
551 |
# -------------------------------
|
552 |
# Editor Edition Tab
|
553 |
# -------------------------------
|
|
|
554 |
def render_editor(text_element):
|
555 |
"""
|
556 |
Processes the Text XML element and converts it to plaintext.
|
@@ -592,22 +593,16 @@ def render_editor(text_element):
|
|
592 |
|
593 |
return process_element(text_element).strip()
|
594 |
|
595 |
-
# Assuming 'df' is your DataFrame and 'inscriptions_content' is defined appropriately
|
596 |
-
# Here's the updated 'with tabs[3]:' block:
|
597 |
-
|
598 |
with tabs[3]:
|
599 |
st.subheader("Editor Edition")
|
600 |
|
601 |
# Select Inscription
|
602 |
inscription_numbers = df['Number'].tolist()
|
603 |
selected_inscription_num = st.selectbox("Select Inscription Number", inscription_numbers, key='editor_select')
|
604 |
-
selected_inscription = df[df['Number'] == selected_inscription_num].iloc[0]
|
605 |
|
606 |
-
#
|
607 |
-
inscriptions_content = selected_inscription['Content']
|
608 |
-
|
609 |
-
# Parse the selected inscription's XML to get the Text element
|
610 |
try:
|
|
|
611 |
tree = ET.ElementTree(ET.fromstring(inscriptions_content))
|
612 |
root = tree.getroot()
|
613 |
|
@@ -629,6 +624,7 @@ with tabs[3]:
|
|
629 |
st.error(f"Error parsing XML: {e}")
|
630 |
except Exception as e:
|
631 |
st.error(f"An unexpected error occurred: {e}")
|
|
|
632 |
# -------------------------------
|
633 |
# Visualization Tab
|
634 |
# -------------------------------
|
|
|
551 |
# -------------------------------
|
552 |
# Editor Edition Tab
|
553 |
# -------------------------------
|
554 |
+
|
555 |
def render_editor(text_element):
|
556 |
"""
|
557 |
Processes the Text XML element and converts it to plaintext.
|
|
|
593 |
|
594 |
return process_element(text_element).strip()
|
595 |
|
|
|
|
|
|
|
596 |
with tabs[3]:
|
597 |
st.subheader("Editor Edition")
|
598 |
|
599 |
# Select Inscription
|
600 |
inscription_numbers = df['Number'].tolist()
|
601 |
selected_inscription_num = st.selectbox("Select Inscription Number", inscription_numbers, key='editor_select')
|
|
|
602 |
|
603 |
+
# Parse the entire XML to find the selected inscription
|
|
|
|
|
|
|
604 |
try:
|
605 |
+
# Parse the entire XML content
|
606 |
tree = ET.ElementTree(ET.fromstring(inscriptions_content))
|
607 |
root = tree.getroot()
|
608 |
|
|
|
624 |
st.error(f"Error parsing XML: {e}")
|
625 |
except Exception as e:
|
626 |
st.error(f"An unexpected error occurred: {e}")
|
627 |
+
|
628 |
# -------------------------------
|
629 |
# Visualization Tab
|
630 |
# -------------------------------
|