Spaces:
Runtime error
Runtime error
Victoria Slocum
commited on
Commit
•
c38a3d1
1
Parent(s):
33ef7a6
scrollbar fix
Browse files- app.py +3 -3
- scrollbar.css +22 -0
app.py
CHANGED
@@ -37,7 +37,7 @@ def dependency(text, col_punct, col_phrase, compact, bg, font, model):
|
|
37 |
doc = nlp(text)
|
38 |
options = {"compact": compact, "collapse_phrases": col_phrase,
|
39 |
"collapse_punct": col_punct, "bg": bg, "color": font}
|
40 |
-
html = '<div style="overflow-x: auto; min-width:101%;">'
|
41 |
html = html + displacy.render(doc, style="dep", options=options) + '</div>'
|
42 |
print(html)
|
43 |
return html
|
@@ -120,7 +120,7 @@ def span(text, span1, span2, label1, label2, model):
|
|
120 |
Span(doc, idx2_1, idx2_2, label2),
|
121 |
]
|
122 |
else:
|
123 |
-
idx1_1 = 0
|
124 |
idx1_2 = round(len(list(doc)) / 2)
|
125 |
idx2_1 = 0
|
126 |
idx2_2 = 1
|
@@ -142,7 +142,7 @@ def get_text(model):
|
|
142 |
return new_text
|
143 |
|
144 |
|
145 |
-
demo = gr.Blocks()
|
146 |
|
147 |
with demo:
|
148 |
with gr.Box():
|
|
|
37 |
doc = nlp(text)
|
38 |
options = {"compact": compact, "collapse_phrases": col_phrase,
|
39 |
"collapse_punct": col_punct, "bg": bg, "color": font}
|
40 |
+
html = '<div class="frame" style="overflow-x: auto; min-width:101%;">'
|
41 |
html = html + displacy.render(doc, style="dep", options=options) + '</div>'
|
42 |
print(html)
|
43 |
return html
|
|
|
120 |
Span(doc, idx2_1, idx2_2, label2),
|
121 |
]
|
122 |
else:
|
123 |
+
idx1_1 = 0
|
124 |
idx1_2 = round(len(list(doc)) / 2)
|
125 |
idx2_1 = 0
|
126 |
idx2_2 = 1
|
|
|
142 |
return new_text
|
143 |
|
144 |
|
145 |
+
demo = gr.Blocks(css="scrollbar.css")
|
146 |
|
147 |
with demo:
|
148 |
with gr.Box():
|
scrollbar.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.frame::-webkit-scrollbar {
|
2 |
+
-webkit-appearance: none;
|
3 |
+
}
|
4 |
+
|
5 |
+
.frame::-webkit-scrollbar:vertical {
|
6 |
+
width: 11px;
|
7 |
+
}
|
8 |
+
|
9 |
+
.frame::-webkit-scrollbar:horizontal {
|
10 |
+
height: 11px;
|
11 |
+
}
|
12 |
+
|
13 |
+
.frame::-webkit-scrollbar-thumb {
|
14 |
+
border-radius: 8px;
|
15 |
+
border: 2px solid white; /* should match background, can't be transparent */
|
16 |
+
background-color: rgba(0, 0, 0, .5);
|
17 |
+
}
|
18 |
+
|
19 |
+
.frame::-webkit-scrollbar-track {
|
20 |
+
background-color: #fff;
|
21 |
+
border-radius: 8px;
|
22 |
+
}
|