Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,26 +85,28 @@ with st.expander("Search by Common Terms 📚"):
|
|
85 |
if st.button(f"Select Row {idx}", key=f"row_{idx}"):
|
86 |
st.session_state['last_clicked_row'] = idx
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
# Check if 'last_clicked_row' is set and in the filtered data
|
89 |
if st.session_state['last_clicked_row'] is not None and st.session_state['last_clicked_row'] in filtered_data.index:
|
|
|
|
|
90 |
selected_row = filtered_data.loc[st.session_state['last_clicked_row']]
|
91 |
-
|
92 |
-
# Extract only the first three columns of the selected row
|
93 |
first_three_columns = selected_row.iloc[:3]
|
94 |
-
|
95 |
-
# Display these columns in the main area
|
96 |
-
st.write("Selected Row Details:")
|
97 |
for col in first_three_columns.index:
|
98 |
st.write(f"{col}: {first_three_columns[col]}")
|
99 |
|
100 |
-
#
|
101 |
-
|
102 |
-
question_text = selected_row.get("question", "No question field")
|
103 |
-
full_text = f"{additional_info} Question: {question_text}"
|
104 |
-
|
105 |
-
documentHTML5 = generate_html_with_textarea(full_text)
|
106 |
-
components.html(documentHTML5, width=1280, height=1024)
|
107 |
|
|
|
|
|
108 |
# Inject HTML5 and JavaScript for styling
|
109 |
st.markdown("""
|
110 |
<style>
|
|
|
85 |
if st.button(f"Select Row {idx}", key=f"row_{idx}"):
|
86 |
st.session_state['last_clicked_row'] = idx
|
87 |
|
88 |
+
# Generate HTML content for the selected row
|
89 |
+
first_three_columns = row.iloc[:3]
|
90 |
+
additional_info = ' '.join([f"{col}: {val}" for col, val in first_three_columns.items()])
|
91 |
+
question_text = row.get("question", "No question field")
|
92 |
+
full_text = f"{additional_info} Question: {question_text}"
|
93 |
+
|
94 |
+
st.session_state['selected_row_html'] = generate_html_with_textarea(full_text)
|
95 |
+
|
96 |
# Check if 'last_clicked_row' is set and in the filtered data
|
97 |
if st.session_state['last_clicked_row'] is not None and st.session_state['last_clicked_row'] in filtered_data.index:
|
98 |
+
# Display details of the selected row in the main area
|
99 |
+
st.write("Selected Row Details:")
|
100 |
selected_row = filtered_data.loc[st.session_state['last_clicked_row']]
|
|
|
|
|
101 |
first_three_columns = selected_row.iloc[:3]
|
|
|
|
|
|
|
102 |
for col in first_three_columns.index:
|
103 |
st.write(f"{col}: {first_three_columns[col]}")
|
104 |
|
105 |
+
# Display the HTML content for the selected row
|
106 |
+
components.html(st.session_state['selected_row_html'], width=1280, height=1024)
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
|
109 |
+
|
110 |
# Inject HTML5 and JavaScript for styling
|
111 |
st.markdown("""
|
112 |
<style>
|