Spaces:
Runtime error
Runtime error
Commit
•
a12f8eb
1
Parent(s):
8c69494
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
resumidor = pipeline('text2text-generation', model='luisvarona/modelo_resumen')
|
7 |
+
|
8 |
+
# Definimos una función que se encarga de llevar a cabo las predicciones
|
9 |
+
def predict(str):
|
10 |
+
# dic_label_score = classifier(str)[0]
|
11 |
+
# label = dic_label_score['label']
|
12 |
+
# score = dic_label_score['score']
|
13 |
+
# dicc = {'LABEL_0': 'ABBR', 'LABEL_1': 'ENTY', 'LABEL_2': 'DESC', 'LABEL_3': 'HUM', 'LABEL_4': 'LOC', 'LABEL_5': 'NUM'}
|
14 |
+
# label = dicc[label]
|
15 |
+
return resumidor(str)
|
16 |
+
|
17 |
+
# Creamos la interfaz y la lanzamos.
|
18 |
+
gr.Interface(fn=predict, inputs="textbox", outputs="textbox", examples=['How old are you?','What time is it?']).launch(share=True)
|