TeresaSchaman commited on
Commit
fc7bd28
·
verified ·
1 Parent(s): 839c510

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
+
4
+ # Carga el modelo y el tokenizer
5
+ model = AutoModelForSequenceClassification.from_pretrained("./path_to_model")
6
+ tokenizer = AutoTokenizer.from_pretrained("./path_to_model")
7
+
8
+ def predict(text):
9
+ inputs = tokenizer(text, return_tensors="pt")
10
+ outputs = model(**inputs)
11
+ return outputs.logits.argmax().item()
12
+
13
+ # Crea la interfaz de Gradio
14
+ iface = gr.Interface(fn=predict, inputs="text", outputs="label")