Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,11 @@ import plotly.graph_objects as go
|
|
| 24 |
from wordcloud import WordCloud
|
| 25 |
from PIL import Image
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
def hex_to_rgb(hex_color: str) -> tuple[int, int, int]:
|
| 28 |
hex_color = hex_color.lstrip('#')
|
| 29 |
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
|
|
@@ -85,11 +90,6 @@ def generate_charts(ner_output_bin: dict) -> Tuple[go.Figure, np.ndarray]:
|
|
| 85 |
bin_labels = list(entity_counts_bin.keys())
|
| 86 |
bin_sizes = list(entity_counts_bin.values())
|
| 87 |
|
| 88 |
-
bin_color_map = {
|
| 89 |
-
"External": "#00008B",
|
| 90 |
-
"Internal": "#8B0000"
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
bin_colors = [bin_color_map.get(label, "#FFFFFF") for label in bin_labels]
|
| 94 |
|
| 95 |
# Create bar chart for binary classification
|
|
@@ -182,10 +182,7 @@ iface = gr.Interface(
|
|
| 182 |
inputs=gr.Textbox(lines=5, label="Input Text", placeholder="Write about how your breakfast went or anything else that happened or might happen to you ..."),
|
| 183 |
outputs=[
|
| 184 |
gr.HighlightedText(label="Binary Sequence Classification",
|
| 185 |
-
|
| 186 |
-
"External": "#00008B",
|
| 187 |
-
"Internal": "#8B0000"
|
| 188 |
-
}
|
| 189 |
),
|
| 190 |
gr.Plot(label="Binary SeqClass Entity Count Bar Chart"),
|
| 191 |
gr.Image(label="Entity Word Cloud")
|
|
|
|
| 24 |
from wordcloud import WordCloud
|
| 25 |
from PIL import Image
|
| 26 |
|
| 27 |
+
bin_color_map = {
|
| 28 |
+
"External": "#00008B",
|
| 29 |
+
"Internal": "#8B0000"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
def hex_to_rgb(hex_color: str) -> tuple[int, int, int]:
|
| 33 |
hex_color = hex_color.lstrip('#')
|
| 34 |
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
|
|
|
|
| 90 |
bin_labels = list(entity_counts_bin.keys())
|
| 91 |
bin_sizes = list(entity_counts_bin.values())
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
bin_colors = [bin_color_map.get(label, "#FFFFFF") for label in bin_labels]
|
| 94 |
|
| 95 |
# Create bar chart for binary classification
|
|
|
|
| 182 |
inputs=gr.Textbox(lines=5, label="Input Text", placeholder="Write about how your breakfast went or anything else that happened or might happen to you ..."),
|
| 183 |
outputs=[
|
| 184 |
gr.HighlightedText(label="Binary Sequence Classification",
|
| 185 |
+
color_map = bin_color_map
|
|
|
|
|
|
|
|
|
|
| 186 |
),
|
| 187 |
gr.Plot(label="Binary SeqClass Entity Count Bar Chart"),
|
| 188 |
gr.Image(label="Entity Word Cloud")
|