Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME"
|
| 5 |
+
repo_id = "luisvarona/clasificador-trek"
|
| 6 |
+
|
| 7 |
+
classifier = pipeline("text-classification", model="luisvarona/clasificador-trek")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# Definimos una funci贸n que se encarga de llevar a cabo las predicciones
|
| 11 |
+
def predict(str):
|
| 12 |
+
#img = PILImage.create(img)
|
| 13 |
+
dic_label_score = classifier(str)
|
| 14 |
+
return dic_label_score[score]
|
| 15 |
+
|
| 16 |
+
# Creamos la interfaz y la lanzamos.
|
| 17 |
+
gr.Interface(fn=predict, inputs="textbox", outputs="textbox").launch(share=True) #examples=['im1.png','im2.png']
|