Christopher Román Jaimes
commited on
Commit
•
a54c5a9
1
Parent(s):
09bf729
chore: add gliner space.
Browse files- app.py +43 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gliner import GLiNER
|
3 |
+
|
4 |
+
model = GLiNER.from_pretrained("chris32/gliner_multi_pii_real_state-v2")
|
5 |
+
model.eval()
|
6 |
+
|
7 |
+
#text = """
|
8 |
+
#Casa en venta Valle de San Ángel, San Pedro Garza García**Para remodelar o demoler Casa de 1220 m2 de terreno y 1400 m2 de construcciónCasa de 3 niveles-Sala-Comedor-Cocina-Estancia-Preparación para alberca-Cochera para 3 autos techada -4 recamaras -Lavandería"Esta es una de las varias opciones que tenemos para ti. Somos una agencia de bienes raíces especializada en la venta y renta de vivienda residencial, te brindamos un servicio personalizado y de alta calidad. Si necesitas ayuda para comprar o rentar, contáctanos y uno de nuestros asesores te atenderá.
|
9 |
+
#"""
|
10 |
+
#for entity in entities:
|
11 |
+
# print(entity["text"], "=>", entity["label"])
|
12 |
+
|
13 |
+
def generate_answer(text):
|
14 |
+
labels = [
|
15 |
+
'SUPERFICIE_JARDIN',
|
16 |
+
'NOMBRE_CLUB_GOLF',
|
17 |
+
'SUPERFICIE_TERRENO',
|
18 |
+
'SUPERFICIE_HABITABLE',
|
19 |
+
'SUPERFICIE_TERRAZA',
|
20 |
+
'NOMBRE_COMPLETO_ARQUITECTO',
|
21 |
+
'SUPERFICIE_BALCON',
|
22 |
+
'NOMBRE_DESARROLLO',
|
23 |
+
'NOMBRE_TORRE',
|
24 |
+
'NOMBRE_CONDOMINIO',
|
25 |
+
'AÑO_REMODELACIÓN'
|
26 |
+
]
|
27 |
+
entities = model.predict_entities(text, labels, threshold=0.4)
|
28 |
+
result_dict = entities
|
29 |
+
|
30 |
+
return result_dict
|
31 |
+
|
32 |
+
# Cambiar a entrada de texto
|
33 |
+
text_input = gr.inputs.Textbox(lines=15, label="Input Text")
|
34 |
+
|
35 |
+
iface = gr.Interface(
|
36 |
+
fn=generate_answer,
|
37 |
+
inputs=text_input,
|
38 |
+
outputs="text",
|
39 |
+
title="Text Intelligence for Real State",
|
40 |
+
description="Input text describing the property."
|
41 |
+
)
|
42 |
+
|
43 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers==4.38.2
|
2 |
+
gliner=="0.1.13"
|