Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +2 -42
src/streamlit_app.py
CHANGED
|
@@ -14,46 +14,7 @@ from typing import Optional
|
|
| 14 |
from gliner import GLiNER
|
| 15 |
from comet_ml import Experiment
|
| 16 |
|
| 17 |
-
|
| 18 |
-
"""
|
| 19 |
-
<style>
|
| 20 |
-
/* Main app background and text color */
|
| 21 |
-
.stApp {
|
| 22 |
-
background-color: #E8F5E9; /* A very light green */
|
| 23 |
-
color: #1B5E20; /* Dark green for the text */
|
| 24 |
-
}
|
| 25 |
-
/* Sidebar background color */
|
| 26 |
-
.css-1d36184 {
|
| 27 |
-
background-color: #A5D6A7; /* A medium light green */
|
| 28 |
-
secondary-background-color: #A5D6A7;
|
| 29 |
-
}
|
| 30 |
-
/* Expander background color and header */
|
| 31 |
-
.streamlit-expanderContent, .streamlit-expanderHeader {
|
| 32 |
-
background-color: #E8F5E9;
|
| 33 |
-
}
|
| 34 |
-
/* Text Area background and text color */
|
| 35 |
-
.stTextArea textarea {
|
| 36 |
-
background-color: #81C784; /* A slightly darker medium green */
|
| 37 |
-
color: #1B5E20; /* Dark green for text */
|
| 38 |
-
}
|
| 39 |
-
/* Button background and text color */
|
| 40 |
-
.stButton > button {
|
| 41 |
-
background-color: #81C784;
|
| 42 |
-
color: #1B5E20;
|
| 43 |
-
}
|
| 44 |
-
/* Warning box background and text color */
|
| 45 |
-
.stAlert.st-warning {
|
| 46 |
-
background-color: #66BB6A; /* A medium-dark green for the warning box */
|
| 47 |
-
color: #1B5E20;
|
| 48 |
-
}
|
| 49 |
-
/* Success box background and text color */
|
| 50 |
-
.stAlert.st-success {
|
| 51 |
-
background-color: #66BB6A; /* A medium-dark green for the success box */
|
| 52 |
-
color: #1B5E20;
|
| 53 |
-
}
|
| 54 |
-
</style>
|
| 55 |
-
""",
|
| 56 |
-
unsafe_allow_html=True)
|
| 57 |
|
| 58 |
# --- Page Configuration and UI Elements ---
|
| 59 |
st.set_page_config(layout="wide", page_title="Named Entity Recognition App")
|
|
@@ -118,7 +79,6 @@ def load_ner_model():
|
|
| 118 |
except Exception as e:
|
| 119 |
st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
|
| 120 |
st.stop()
|
| 121 |
-
|
| 122 |
model = load_ner_model()
|
| 123 |
# Flatten the mapping to a single dictionary
|
| 124 |
reverse_category_mapping = {label: category for category, label_list in category_mapping.items() for label in label_list}
|
|
@@ -250,7 +210,7 @@ if st.button("Results"):
|
|
| 250 |
if comet_initialized:
|
| 251 |
experiment.log_figure(figure=fig_treemap, figure_name="entity_treemap_categories")
|
| 252 |
experiment.end()
|
| 253 |
-
|
| 254 |
# Corrected placement for time calculation and display
|
| 255 |
end_time = time.time()
|
| 256 |
elapsed_time = end_time - start_time
|
|
|
|
| 14 |
from gliner import GLiNER
|
| 15 |
from comet_ml import Experiment
|
| 16 |
|
| 17 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# --- Page Configuration and UI Elements ---
|
| 20 |
st.set_page_config(layout="wide", page_title="Named Entity Recognition App")
|
|
|
|
| 79 |
except Exception as e:
|
| 80 |
st.error(f"Failed to load NER model. Please check your internet connection or model availability: {e}")
|
| 81 |
st.stop()
|
|
|
|
| 82 |
model = load_ner_model()
|
| 83 |
# Flatten the mapping to a single dictionary
|
| 84 |
reverse_category_mapping = {label: category for category, label_list in category_mapping.items() for label in label_list}
|
|
|
|
| 210 |
if comet_initialized:
|
| 211 |
experiment.log_figure(figure=fig_treemap, figure_name="entity_treemap_categories")
|
| 212 |
experiment.end()
|
| 213 |
+
|
| 214 |
# Corrected placement for time calculation and display
|
| 215 |
end_time = time.time()
|
| 216 |
elapsed_time = end_time - start_time
|