File size: 508 Bytes
12c460c
 
 
754acee
12c460c
 
fd2392a
 
 
754acee
12c460c
 
9e7abab
12c460c
754acee
12c460c
 
 
 
 
 
d8ded2a
12c460c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from transformers import AutoTokenizer
from model import MultiHeadClassification
import spaces


model = MultiHeadClassification.from_pretrained(
    'philipp-zettl/multi-head-sequence-classification-model',
    {"GGU": 3, "sentiment": 3}
).to('cuda')
tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-m3')

#@spaces.GPU()
def generate(prompt):
    inputs = tokenizer([prompt]).to('cuda')
    return model(**inputs)


gr.Interface(
    generate,
    inputs="text",
    outputs="label"
)