Spaces:
Runtime error
Runtime error
Isaac Isaías
commited on
Commit
•
ceecf58
1
Parent(s):
16daaa3
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,42 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
if __name__ == "__main__":
|
7 |
-
gr.Interface
|
8 |
-
|
|
|
9 |
lines=2,
|
10 |
placeholder="Ingrese de favor el título de la tesis o un fragmento de esta.",
|
11 |
-
)
|
12 |
outputs=["text"],
|
|
|
|
|
|
|
13 |
examples=[examples],
|
14 |
-
title="Clasificador de Tesis",
|
15 |
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline
|
3 |
|
4 |
+
title = "Clasificador de Tesis"
|
5 |
+
|
6 |
+
description = "hugginface/hackathon-pln-es/unam_tesis_BETO_finnetuning"
|
7 |
+
|
8 |
+
article = """
|
9 |
+
## Miembros del Equipo:
|
10 |
+
- Isaac Isaías López López ([MajorIsaiah](https://huggingface.co/MajorIsaiah))
|
11 |
+
- Dionis López Ramos ([inoid](https://huggingface.co/inoid))
|
12 |
+
- Yisel Clavel Quintero ([clavel](https://huggingface.co/clavel))
|
13 |
+
- Ximena Yeraldin López López ([Ximyer](https://huggingface.co/Ximyer))
|
14 |
+
"""
|
15 |
+
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained('hiiamsid/BETO_es_binary_classification', use_fast=False)
|
17 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
18 |
+
'hackathon-pln-e/unam_tesis_beto_finnetuning', num_labels=5, output_attentions=False, output_hidden_states=False)
|
19 |
+
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True)
|
20 |
+
|
21 |
+
classificationResult = pipe("El objetivo de esta tesis es elaborar un estudio de las condiciones asociadas al aprendizaje desde casa.")
|
22 |
+
|
23 |
+
|
24 |
+
def thesis_prediction(input):
|
25 |
+
pass
|
26 |
+
|
27 |
+
|
28 |
+
examples = ["Introducción al análisis de riesgos competitivos bajo el enfoque de la función de incidencia acumulada (FIA) y su aplicación con R", "Los promedios de calificaciones y clasificar por grupo o asignatura se realizaron a través de tablas dinámicas en Excel"]
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
+
gr.Interface(
|
32 |
+
fn=thesis_prediction,
|
33 |
+
inputs=gr.inputs.Textbox(
|
34 |
lines=2,
|
35 |
placeholder="Ingrese de favor el título de la tesis o un fragmento de esta.",
|
36 |
+
),
|
37 |
outputs=["text"],
|
38 |
+
title=title,
|
39 |
+
description=description,
|
40 |
+
article=article,
|
41 |
examples=[examples],
|
|
|
42 |
).launch()
|