Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
-
|
|
|
|
|
4 |
sentences = raw.split("$")
|
5 |
embeddings = model.encode(sentences)
|
6 |
return embeddings
|
@@ -11,7 +13,5 @@ with gr.Blocks(theme='SnowFlash383935/emerald') as demo:
|
|
11 |
inp = gr.Textbox(placeholder="What is your name?")
|
12 |
out = gr.Textbox()
|
13 |
btn = gr.Button("Run")
|
14 |
-
|
15 |
-
btn.click(fn=update, inputs=[inp, model], outputs=out)
|
16 |
-
|
17 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
+
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
4 |
+
def update(raw):
|
5 |
+
global model
|
6 |
sentences = raw.split("$")
|
7 |
embeddings = model.encode(sentences)
|
8 |
return embeddings
|
|
|
13 |
inp = gr.Textbox(placeholder="What is your name?")
|
14 |
out = gr.Textbox()
|
15 |
btn = gr.Button("Run")
|
16 |
+
btn.click(fn=update, inputs=inp, outputs=out)
|
|
|
|
|
17 |
demo.launch()
|