Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ def load_jsonl(file_path):
|
|
11 |
data.append(json.loads(line))
|
12 |
return pd.DataFrame(data)
|
13 |
|
|
|
14 |
# Your filter_by_keyword function
|
15 |
def filter_by_keyword(data, term):
|
16 |
# Your filtering logic here
|
@@ -42,10 +43,7 @@ def generate_html_with_textarea(row):
|
|
42 |
</body>
|
43 |
</html>
|
44 |
'''
|
45 |
-
|
46 |
-
# Initialize session state for tracking the last clicked row
|
47 |
-
if 'last_clicked_row' not in st.session_state:
|
48 |
-
st.session_state['last_clicked_row'] = None
|
49 |
|
50 |
|
51 |
# Streamlit App 🚀
|
@@ -91,11 +89,11 @@ with st.expander("Search by Common Terms 📚"):
|
|
91 |
html_content = generate_html_with_textarea(selected_row)
|
92 |
components.html(html_content, width=1280, height=1024)
|
93 |
|
94 |
-
# Always show the first row
|
95 |
if not filtered_data.empty:
|
96 |
first_row_html = generate_html_with_textarea(filtered_data.iloc[0])
|
97 |
components.html(first_row_html, width=1280, height=1024)
|
98 |
-
|
99 |
# Inject HTML5 and JavaScript for styling
|
100 |
st.markdown("""
|
101 |
<style>
|
|
|
11 |
data.append(json.loads(line))
|
12 |
return pd.DataFrame(data)
|
13 |
|
14 |
+
|
15 |
# Your filter_by_keyword function
|
16 |
def filter_by_keyword(data, term):
|
17 |
# Your filtering logic here
|
|
|
43 |
</body>
|
44 |
</html>
|
45 |
'''
|
46 |
+
filtered_data = pd.DataFrame()
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
# Streamlit App 🚀
|
|
|
89 |
html_content = generate_html_with_textarea(selected_row)
|
90 |
components.html(html_content, width=1280, height=1024)
|
91 |
|
92 |
+
# Always show the first row if filtered_data is not empty
|
93 |
if not filtered_data.empty:
|
94 |
first_row_html = generate_html_with_textarea(filtered_data.iloc[0])
|
95 |
components.html(first_row_html, width=1280, height=1024)
|
96 |
+
|
97 |
# Inject HTML5 and JavaScript for styling
|
98 |
st.markdown("""
|
99 |
<style>
|