Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +15 -1
src/streamlit_app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
os.environ['HF_HOME'] = '/tmp'
|
|
|
|
|
|
|
| 3 |
import time
|
| 4 |
import streamlit as st
|
| 5 |
import streamlit.components.v1 as components
|
|
@@ -454,6 +456,16 @@ st.set_page_config(layout="wide", page_title="NER & Topic Report App")
|
|
| 454 |
st.markdown(
|
| 455 |
"""
|
| 456 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 457 |
/* CSS Media Query: Only show the content inside this selector when the screen width is 600px or less (typical mobile size) */
|
| 458 |
@media (max-width: 600px) {
|
| 459 |
#mobile-warning-container {
|
|
@@ -541,7 +553,9 @@ def load_ner_model(labels):
|
|
| 541 |
# The model requires constraints (labels) to be passed during loading
|
| 542 |
return GLiNER.from_pretrained("knowledgator/gliner-multitask-large-v0.5", nested_ner=True, num_gen_sequences=2, gen_constraints=labels)
|
| 543 |
except Exception as e:
|
| 544 |
-
|
|
|
|
|
|
|
| 545 |
st.stop()
|
| 546 |
|
| 547 |
# --- LONG DEFAULT TEXT (178 Words) ---
|
|
|
|
| 1 |
import os
|
| 2 |
os.environ['HF_HOME'] = '/tmp'
|
| 3 |
+
import os
|
| 4 |
+
os.environ['HF_HOME'] = '/tmp'
|
| 5 |
import time
|
| 6 |
import streamlit as st
|
| 7 |
import streamlit.components.v1 as components
|
|
|
|
| 456 |
st.markdown(
|
| 457 |
"""
|
| 458 |
<style>
|
| 459 |
+
/* FIX: Aggressive theme override to ensure visibility */
|
| 460 |
+
body {
|
| 461 |
+
background-color: #f0f2f6 !important; /* Force a light background */
|
| 462 |
+
color: #333333 !important; /* Force dark text */
|
| 463 |
+
}
|
| 464 |
+
/* Ensure main Streamlit container background is also light */
|
| 465 |
+
[data-testid="stAppViewBlock"] {
|
| 466 |
+
background-color: #ffffff !important;
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
/* CSS Media Query: Only show the content inside this selector when the screen width is 600px or less (typical mobile size) */
|
| 470 |
@media (max-width: 600px) {
|
| 471 |
#mobile-warning-container {
|
|
|
|
| 553 |
# The model requires constraints (labels) to be passed during loading
|
| 554 |
return GLiNER.from_pretrained("knowledgator/gliner-multitask-large-v0.5", nested_ner=True, num_gen_sequences=2, gen_constraints=labels)
|
| 555 |
except Exception as e:
|
| 556 |
+
# Log the actual error to the console for debugging
|
| 557 |
+
print(f"FATAL ERROR: Failed to load NER model: {e}")
|
| 558 |
+
st.error(f"Failed to load NER model. This may be due to a dependency issue or resource limits: {e}")
|
| 559 |
st.stop()
|
| 560 |
|
| 561 |
# --- LONG DEFAULT TEXT (178 Words) ---
|