Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from sentence_transformers import SentenceTransformer
|
| 3 |
+
|
| 4 |
+
model_Q = SentenceTransformer('sentence-transformers/all-MiniLM-L12-v2')
|
| 5 |
+
|
| 6 |
+
def text_to_embedding(text):
|
| 7 |
+
embedding = model_Q.encode(text)
|
| 8 |
+
return embedding
|
| 9 |
+
|
| 10 |
+
inputs = gr.inputs.Textbox(default="Type text here.")
|
| 11 |
+
outputs = gr.outputs.Textbox()
|
| 12 |
+
|
| 13 |
+
app = gr.Interface(fn=text_to_embedding, inputs=inputs, outputs=outputs, title="Text to Embedding")
|
| 14 |
+
app.launch()
|