Update app.py
Browse files
app.py
CHANGED
|
@@ -16,18 +16,18 @@ import gradio as gr
|
|
| 16 |
#model = learn.model
|
| 17 |
#model = model.cpu()
|
| 18 |
|
| 19 |
-
repo_id = "maviced/practica7-2"
|
| 20 |
-
learn = from_pretrained_fastai(repo_id)
|
| 21 |
-
model = learn.model
|
| 22 |
-
model = model.cpu()
|
| 23 |
|
| 24 |
#classifier = pipeline('text-classification', model='maviced/clasificador-rotten-tomatoes')
|
| 25 |
|
| 26 |
def predict(text):
|
| 27 |
-
pred,pred_idx,probs = model.predict(text)
|
| 28 |
-
return pred
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
gr.Interface(fn=predict, inputs="text", outputs="text",examples=['A visually stunning and emotionally resonant film that leaves a lasting impact.',
|
| 33 |
'The film, while visually stunning, falls short with a predictable plot and underdeveloped characters, leaving the audience craving more substance.']).launch(share=True)
|
|
|
|
| 16 |
#model = learn.model
|
| 17 |
#model = model.cpu()
|
| 18 |
|
| 19 |
+
#repo_id = "maviced/practica7-2"
|
| 20 |
+
#learn = from_pretrained_fastai(repo_id)
|
| 21 |
+
#model = learn.model
|
| 22 |
+
#model = model.cpu()
|
| 23 |
|
| 24 |
#classifier = pipeline('text-classification', model='maviced/clasificador-rotten-tomatoes')
|
| 25 |
|
| 26 |
def predict(text):
|
| 27 |
+
#pred,pred_idx,probs = model.predict(text)
|
| 28 |
+
#return pred
|
| 29 |
|
| 30 |
+
return classifier(text)[0]['label']
|
| 31 |
|
| 32 |
gr.Interface(fn=predict, inputs="text", outputs="text",examples=['A visually stunning and emotionally resonant film that leaves a lasting impact.',
|
| 33 |
'The film, while visually stunning, falls short with a predictable plot and underdeveloped characters, leaving the audience craving more substance.']).launch(share=True)
|