lys475964044 commited on
Commit
3f5d001
·
verified ·
1 Parent(s): 572fce1

Add app.py to deploy the model

Browse files
Files changed (1) hide show
  1. app.py +13 -0
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()