viv commited on
Commit
a76b14b
·
verified ·
1 Parent(s): 95c1095

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
3
+
4
+ # Load model and tokenizer
5
+ tokenizer = AutoTokenizer.from_pretrained("viv/UD_Greek-GUD")
6
+ model = AutoModelForTokenClassification.from_pretrained("viv/UD_Greek-GUD")
7
+
8
+ def predict(text):
9
+ inputs = tokenizer(text, return_tensors="pt")
10
+ outputs = model(**inputs)
11
+ return outputs.logits.argmax(-1).tolist()
12
+
13
+ # Interface
14
+ interface = gr.Interface(
15
+ fn=predict,
16
+ inputs="text",
17
+ outputs="text",
18
+ title="UD Greek GUD Model",
19
+ description="Upload a text for analysis using the UD Greek GUD model.",
20
+ )
21
+
22
+ interface.launch()