Delete app.py
Browse files
app.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
pip install torch
|
| 3 |
-
import torch
|
| 4 |
-
from transformers import AutoTokenizer, AutoModel
|
| 5 |
-
|
| 6 |
-
def get_embeddings(text):
|
| 7 |
-
tokenizer = AutoTokenizer.from_pretrained("GroNLP/bert-base-dutch-cased")
|
| 8 |
-
model = AutoModel.from_pretrained("GroNLP/bert-base-dutch-cased", output_hidden_states=True)
|
| 9 |
-
sent = str(text)
|
| 10 |
-
encoded = tokenizer.encode_plus(sent, return_tensors="pt")
|
| 11 |
-
with torch.no_grad():
|
| 12 |
-
output = model(**encoded)
|
| 13 |
-
|
| 14 |
-
states = output.hidden_states
|
| 15 |
-
return states
|
| 16 |
-
|
| 17 |
-
iface = gr.Interface(fn=get_embeddings,inputs="text",outputs="text")
|
| 18 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|