Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
from fastai.text.all import *
|
| 3 |
+
from datasets import load_dataset
|
| 4 |
+
|
| 5 |
+
learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy,cbs=callbacks).to_fp16()
|
| 6 |
+
learn = learn.load_encoder('finetunedClass.pth')
|
| 7 |
+
|
| 8 |
+
def predict(frase):
|
| 9 |
+
pred = learn.predict(frase)
|
| 10 |
+
return pred
|
| 11 |
+
|
| 12 |
+
gr.Interface(fn=predict, inputs="text", outputs="text", examples=['i had been talking to coach claudia barcomb and coach ali boe for a long time and they both made me feel very welcomed at union']).launch(share=False)
|