Spaces:
Running
Running
Update ui_components.py
Browse files- ui_components.py +16 -5
ui_components.py
CHANGED
|
@@ -192,11 +192,21 @@ def render_frame_result(result_data: Dict[str, Any]):
|
|
| 192 |
col_img, col_text = st.columns([1, 2])
|
| 193 |
|
| 194 |
with col_img:
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
|
| 201 |
with col_text:
|
| 202 |
# Display ontology analysis first if enabled
|
|
@@ -208,6 +218,7 @@ def render_frame_result(result_data: Dict[str, Any]):
|
|
| 208 |
_render_model_output(result_data['result'])
|
| 209 |
|
| 210 |
|
|
|
|
| 211 |
def _render_ontology_analysis(ontology: Dict[str, Any]):
|
| 212 |
"""Render ontology analysis section"""
|
| 213 |
severity = ontology.get('severity', 'NONE')
|
|
|
|
| 192 |
col_img, col_text = st.columns([1, 2])
|
| 193 |
|
| 194 |
with col_img:
|
| 195 |
+
# --- Kompatibel für alte & neue Streamlit-Versionen ---
|
| 196 |
+
try:
|
| 197 |
+
st.image(
|
| 198 |
+
result_data["image"],
|
| 199 |
+
caption=f"Frame {result_data['frame_number']}",
|
| 200 |
+
use_container_width=True # Neuere Streamlit-Versionen
|
| 201 |
+
)
|
| 202 |
+
except TypeError:
|
| 203 |
+
# Fallback für ältere Streamlit-Versionen (z. B. auf Hugging Face)
|
| 204 |
+
st.image(
|
| 205 |
+
result_data["image"],
|
| 206 |
+
caption=f"Frame {result_data['frame_number']}",
|
| 207 |
+
use_column_width=True
|
| 208 |
+
)
|
| 209 |
+
# --- Ende Bildanzeige ---
|
| 210 |
|
| 211 |
with col_text:
|
| 212 |
# Display ontology analysis first if enabled
|
|
|
|
| 218 |
_render_model_output(result_data['result'])
|
| 219 |
|
| 220 |
|
| 221 |
+
|
| 222 |
def _render_ontology_analysis(ontology: Dict[str, Any]):
|
| 223 |
"""Render ontology analysis section"""
|
| 224 |
severity = ontology.get('severity', 'NONE')
|