Spaces:
Runtime error
Runtime error
Update notebook_utils.py
Browse files- notebook_utils.py +15 -2
notebook_utils.py
CHANGED
|
@@ -16,7 +16,7 @@ from typing import List, NamedTuple, Optional, Tuple
|
|
| 16 |
|
| 17 |
import numpy as np
|
| 18 |
from openvino.runtime import Core, Type, get_version
|
| 19 |
-
|
| 20 |
|
| 21 |
import openvino as ov
|
| 22 |
from openvino.runtime.passes import Manager, MatcherPass, WrapType, Matcher
|
|
@@ -607,7 +607,20 @@ class NotebookAlert(Exception):
|
|
| 607 |
self.show_message()
|
| 608 |
|
| 609 |
def show_message(self):
|
| 610 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
|
| 612 |
|
| 613 |
class DeviceNotFoundAlert(NotebookAlert):
|
|
|
|
| 16 |
|
| 17 |
import numpy as np
|
| 18 |
from openvino.runtime import Core, Type, get_version
|
| 19 |
+
import gradio as gr
|
| 20 |
|
| 21 |
import openvino as ov
|
| 22 |
from openvino.runtime.passes import Manager, MatcherPass, WrapType, Matcher
|
|
|
|
| 607 |
self.show_message()
|
| 608 |
|
| 609 |
def show_message(self):
|
| 610 |
+
alert_colors = {
|
| 611 |
+
"info": "blue",
|
| 612 |
+
"warning": "yellow",
|
| 613 |
+
"success": "green",
|
| 614 |
+
"danger": "red"
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
alert_color = alert_colors.get(self.alert_class, "gray") # Default to gray if no match
|
| 618 |
+
|
| 619 |
+
# Gradio will display the alert as an HTML block with a colored background
|
| 620 |
+
alert_html = f'<div style="padding: 10px; background-color: {alert_color}; color: white; border-radius: 5px;">{self.message}</div>'
|
| 621 |
+
|
| 622 |
+
# You can use gr.HTML() to display this message in your Gradio app
|
| 623 |
+
gr.HTML(alert_html).render()
|
| 624 |
|
| 625 |
|
| 626 |
class DeviceNotFoundAlert(NotebookAlert):
|