File size: 365 Bytes
19488e2
0b2ff15
74c5a4a
 
0b2ff15
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import spaces
from transformers import pipeline
import gradio as gr

pipe = pipeline("feature-extraction", model="jinaai/jina-embeddings-v2-base-code", trust_remote_code=True)
pipe.to('cuda')

@spaces.GPU
def generate(prompt):
    return pipe(prompt)[0].numpy().mean(axis=0)

gr.Interface(
    fn=generate,
    inputs=gr.Text(),
    outputs=gr.Gallery(),
).launch()