Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import AutoTokenizer
|
| 3 |
+
from model import MultiHeadClassification
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
model = MultiHeadClassification.from_pretrained('philipp-zettl/multi-head-sequence-classification-model')
|
| 7 |
+
tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-m3')
|
| 8 |
+
|
| 9 |
+
def generate(prompt):
|
| 10 |
+
inputs = tokenizer([prompt])
|
| 11 |
+
return model(**inputs)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
gr.Interface(
|
| 15 |
+
generate,
|
| 16 |
+
inputs="text",
|
| 17 |
+
ouputs="label"
|
| 18 |
+
)
|