AlyxTeam's picture
feat: pipeline方式
0b2ff15
raw
history blame
365 Bytes
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()