Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,18 +5,10 @@ import numpy as np
|
|
5 |
from torchvision import transforms
|
6 |
|
7 |
def predict(text):
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
model.eval()
|
13 |
-
|
14 |
-
model.to(device)
|
15 |
-
with torch.no_grad():
|
16 |
-
outputs = model(text)
|
17 |
-
outputs = torch.argmax(outputs,1)
|
18 |
-
|
19 |
-
return(outputs)
|
20 |
|
21 |
# Creamos la interfaz y la lanzamos.
|
22 |
gr.Interface(fn=predict, inputs="text", outputs="text").launch();
|
|
|
5 |
from torchvision import transforms
|
6 |
|
7 |
def predict(text):
|
8 |
+
|
9 |
+
learnClass = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy,cbs=callbacks).to_fp16()
|
10 |
+
learnClass = learnClass.load_encoder('modelo')
|
11 |
+
return(learnClass.predict(text))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Creamos la interfaz y la lanzamos.
|
14 |
gr.Interface(fn=predict, inputs="text", outputs="text").launch();
|