Spaces:
Sleeping
Sleeping
Add app.py to deploy the model
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import AutoTokenizer, AutoModel
|
3 |
+
|
4 |
+
tokenizer = AutoTokenizer.from_pretrained("HIT-TMG/bge-m3_RAG-conversational-IR")
|
5 |
+
model = AutoModel.from_pretrained("HIT-TMG/bge-m3_RAG-conversational-IR")
|
6 |
+
|
7 |
+
def predict(input_text):
|
8 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
9 |
+
outputs = model(**inputs)
|
10 |
+
return outputs.last_hidden_state[0][0].tolist()
|
11 |
+
|
12 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
13 |
+
iface.launch()
|