Spaces:
Runtime error
Runtime error
Add caching of examples
Browse files
app.py
CHANGED
@@ -85,6 +85,8 @@ button.gallery-item { color: var(--body-text-color) !important; }
|
|
85 |
.confidence-set:hover .label { color: var(--color-red-700) !important; }
|
86 |
"""
|
87 |
|
|
|
|
|
88 |
with gr.Blocks(
|
89 |
css=css,
|
90 |
theme=gr.themes.Monochrome(radius_size=gr.themes.sizes.radius_sm),
|
@@ -99,10 +101,16 @@ with gr.Blocks(
|
|
99 |
"Demonstration of computing cosine similarity of embeddings from the [GloVe](https://nlp.stanford.edu/projects/glove/) dataset."
|
100 |
)
|
101 |
with gr.Row():
|
102 |
-
gr.Examples(
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
with gr.Column():
|
105 |
-
output
|
106 |
|
107 |
btn.click(fn=get_results, inputs=input, outputs=output)
|
108 |
|
|
|
85 |
.confidence-set:hover .label { color: var(--color-red-700) !important; }
|
86 |
"""
|
87 |
|
88 |
+
output = gr.Label(label="Closest words")
|
89 |
+
|
90 |
with gr.Blocks(
|
91 |
css=css,
|
92 |
theme=gr.themes.Monochrome(radius_size=gr.themes.sizes.radius_sm),
|
|
|
101 |
"Demonstration of computing cosine similarity of embeddings from the [GloVe](https://nlp.stanford.edu/projects/glove/) dataset."
|
102 |
)
|
103 |
with gr.Row():
|
104 |
+
gr.Examples(
|
105 |
+
examples,
|
106 |
+
inputs=input,
|
107 |
+
cache_examples=True,
|
108 |
+
outputs=output,
|
109 |
+
fn=get_results,
|
110 |
+
)
|
111 |
|
112 |
with gr.Column():
|
113 |
+
output.render()
|
114 |
|
115 |
btn.click(fn=get_results, inputs=input, outputs=output)
|
116 |
|