from flask import Flask ,render_template ,request ,jsonify ,redirect ,url_for #line:1 import re import pandas as pd #line:2 import ast #line:3 import numpy as np #line:4 import xlrd2 as xlrd #line:5 import unicodedata #line:6 import spacy #line:7 import inflect #line:8 nlp =spacy .load ("es_core_news_md")#line:9 from inflector import Inflector ,Spanish #line:10 inflector =Inflector (Spanish )#line:11 import speech_recognition as sr #line:12 import os #line:13 import requests #line:14 from requests .auth import HTTPBasicAuth #line:15 import asyncio #line:16 import aiohttp #line:17 auth =aiohttp .BasicAuth ('1234','API')#line:20 base_url ='https://orva.tedcas.com/api/'#line:21 archivo ="./preguntas_qh_tags.xlsx"#line:22 xlrd .xlsx .ensure_elementtree_imported (False ,None )#line:25 xlrd .xlsx .Element_has_iter =True #line:26 def remove_non_printable(value): if isinstance(value, str): value = re.sub(r'\n(?=[^\s\d])|(?<=[^\s\d])\\n', ' ', value) value = re.sub(r'\t(?=[^\s\d])|(?<=[^\s\d])\\t', ' ', value) value = re.sub(r'\xa0(?=[^\s\d])|(?<=[^\s\d])\\xa0', ' ', value) value = re.sub(r'\?\\n¿', '? ¿', value) value = re.sub(r'\?\\t¿', '? ¿', value) value = re.sub(r'\?\\xa0¿', '? ¿', value) value = re.sub(r'(\d)\\t', r'\1 ', value) value = re.sub(r'(\d)\\n', r'\1 ', value) value = re.sub(r'(\d)\\xa0', r'\1 ', value) value = re.sub(r'(\s)+\\t', ' ', value) value = re.sub(r'(\s)+\\n', ' ', value) value = re.sub(r'(\s)+\\xa0', ' ', value) value = re.sub(r'\?\s*\\u200b+', '? ', value) return value return value async def faq ():#line:28 OO0000OO00O0OOO00 =pd .read_excel (archivo ,engine ="openpyxl")#line:29 OOOO000OOO0OO0O0O =OO0000OO00O0OOO00 #line:30 OO0000OO00O0OOO00 =xlrd .open_workbook (archivo )#line:31 OO0000OO00O0OOO00 =OO0000OO00O0OOO00 .sheet_by_index (0 )#line:32 O0000OO00OO0OO000 =[]#line:33 OOOO0O00O000OOO00 =[]#line:34 OOOO0O000000O0000 =[]#line:35 OOO0O00OOO000OO00 =pd .read_excel (archivo ,header =1)#line:36 #OOO0O00OOO000OO00 = OOO0O00OOO000OO00.applymap(remove_non_printable) for O0OO00O000OO0O0OO ,OO0000O0O00000O0O in OOO0O00OOO000OO00 .iterrows ():#line:37 if OOOO000OOO0OO0O0O .loc [O0OO00O000OO0O0OO ,'Especialidad']=='trauma':#line:38 O0OOO00O0O0000O0O =OO0000OO00O0OOO00 .cell (int (O0OO00O000OO0O0OO )+1 ,2 )#line:39 OO0O0O0000OOO00O0 =OO0000OO00O0OOO00 .cell (int (O0OO00O000OO0O0OO )+1 ,3 )#line:40 O0OOO00O0O0000O0O =str (O0OOO00O0O0000O0O )#line:41 OO0O0O0000OOO00O0 =str (OO0O0O0000OOO00O0 )#line:42 O0OOO00O0O0000O0O =O0OOO00O0O0000O0O .split ("'")#line:43 OO0O0O0000OOO00O0 =OO0O0O0000OOO00O0 .split ("'")#line:44 O0000OO00OO0OO000 .append (f" {O0OOO00O0O0000O0O[1]} {OO0O0O0000OOO00O0[1]} ")#line:45 O0000OO00OO0OO000=[remove_non_printable(item) for item in O0000OO00OO0OO000] #O0000OO00OO0OO000=O0000OO00OO0OO000.applymap(remove_non_printable) elif OOOO000OOO0OO0O0O .loc [O0OO00O000OO0O0OO ,'Especialidad']=='uro':#line:46 O0OOO00O0O0000O0O =OO0000OO00O0OOO00 .cell (int (O0OO00O000OO0O0OO )+1 ,2 )#line:47 OO0O0O0000OOO00O0 =OO0000OO00O0OOO00 .cell (int (O0OO00O000OO0O0OO )+1 ,3 )#line:48 O0OOO00O0O0000O0O =str (O0OOO00O0O0000O0O )#line:49 OO0O0O0000OOO00O0 =str (OO0O0O0000OOO00O0 )#line:50 O0OOO00O0O0000O0O =O0OOO00O0O0000O0O .split ("'")#line:51 OO0O0O0000OOO00O0 =OO0O0O0000OOO00O0 .split ("'")#line:52 OOOO0O00O000OOO00 .append (f" {O0OOO00O0O0000O0O[1]} {OO0O0O0000OOO00O0[1]} ")#line:53 OOOO0O00O000OOO00=[remove_non_printable(item) for item in OOOO0O00O000OOO00] #OOOO0O00O000OOO00=OOOO0O00O000OOO00.applymap(remove_non_printable) elif OOOO000OOO0OO0O0O .loc [O0OO00O000OO0O0OO ,'Especialidad']=='admin':#line:54 O0OOO00O0O0000O0O =OO0000OO00O0OOO00 .cell (int (O0OO00O000OO0O0OO )+1 ,2 )#line:55 OO0O0O0000OOO00O0 =OO0000OO00O0OOO00 .cell (int (O0OO00O000OO0O0OO )+1 ,3 )#line:56 O0OOO00O0O0000O0O =str (O0OOO00O0O0000O0O )#line:57 OO0O0O0000OOO00O0 =str (OO0O0O0000OOO00O0 )#line:58 O0OOO00O0O0000O0O =O0OOO00O0O0000O0O .split ("'")#line:59 OO0O0O0000OOO00O0 =OO0O0O0000OOO00O0 .split ("'")#line:60 OOOO0O000000O0000 .append (f" {O0OOO00O0O0000O0O[1]} {OO0O0O0000OOO00O0[1]} ")#line:61 OOOO0O000000O0000 = [remove_non_printable(item) for item in OOOO0O000000O0000] #OOOO0O000000O0000=OOOO0O000000O0000.applymap(remove_non_printable) if OO0000O0O00000O0O .dropna ().empty :#line:62 break #line:63 return O0000OO00OO0OO000 ,OOOO0O00O000OOO00 ,OOOO0O000000O0000 #line:64 async def buscar_faq (OOO0O0O0OOOO000OO ,O0OOOOO00OO0000O0 ):#line:66 O00OO0O00O000O00O =pd .read_excel (archivo ,engine ="openpyxl")#line:67 #O00OO0O00O000O00O = O00OO0O00O000O00O.applymap(remove_non_printable) O0OOOOO0OO0OO0000 =O00OO0O00O000O00O #line:68 OO00OO0O000OO0O00 =0 #line:69 O000O00O00O0OO0OO =OOO0O0O0OOOO000OO #line:70 O000O0OO0O0OO0O00 =[]#line:71 print ("result"+str (O000O00O00O0OO0OO ))#line:72 for O000O00OOOO0OO000 ,O00OO000OOOO00OOO in O00OO0O00O000O00O .iterrows ():#line:73 O0O0O00OOOOO0O0O0 =O00OO0O00O000O00O .loc [O000O00OOOO0OO000 ,'TAGS2']#line:74 O0O0O00OOOOO0O0O0 =O0O0O00OOOOO0O0O0 .split (",")#line:75 O000O0OO0O0OO0O00 .append (O0O0O00OOOOO0O0O0 )#line:76 O00O0000OO0O0OOO0 =[]#line:77 O0O0O00OOOOO0O0O0 =[]#line:78 for OOO0O0O0OOOOO0O0O ,O000O0OO0OOOO00OO in enumerate (O000O00O00O0OO0OO ):#line:79 O000O00O00O0OO0OO [OOO0O0O0OOOOO0O0O ]=inflector .singularize (str (O000O0OO0OOOO00OO ))#line:80 OOO00OO000O0O0O00 =np .zeros (len (O00OO0O00O000O00O .index ),dtype =int )#line:81 for OOO0OO0OOOOO00OOO ,O00OO000OOOO00OOO in enumerate (O000O0OO0O0OO0O00 ):#line:82 OOO000OO000000O0O =[]#line:83 for O000O0OO0OOOO00OO in O00OO000OOOO00OOO :#line:84 if O0OOOOO00OO0000O0 ==0 :#line:85 if O000O0OO0OOOO00OO !=[]:#line:86 OO00OO0O000OO0O00 =0 #line:87 for OO0OOO0OOOOOO000O in range (100 ):#line:88 OO0OOO0OOOOOO000O =OO0OOO0OOOOOO000O /10 #line:89 OO0OOO0OOOOOO000O =str (OO0OOO0OOOOOO000O )#line:90 if O000O0OO0OOOO00OO ==OO0OOO0OOOOOO000O :#line:91 OO0OOO0OOOOOO000O =OO0OOO0OOOOOO000O .split (".")#line:92 OOO000OO000000O0O .append (OO0OOO0OOOOOO000O [0 ])#line:93 OOO000OO000000O0O .append ("con")#line:94 OOO000OO000000O0O .append (OO0OOO0OOOOOO000O [1 ])#line:95 OO00OO0O000OO0O00 =OO00OO0O000OO0O00 +1 #line:96 if OO00OO0O000OO0O00 ==0 :#line:97 OOO000OO000000O0O .append (O000O0OO0OOOO00OO )#line:98 if O0OOOOO00OO0000O0 ==1 :#line:99 OOO000OO000000O0O .append (O000O0OO0OOOO00OO )#line:100 O00O0000OO0O0OOO0 .append (OOO000OO000000O0O )#line:101 for O00O0000OOOO0OO00 in O000O00O00O0OO0OO :#line:102 for OOOOO0O0O0O00OO00 ,O000O0OO0OOOO00OO in enumerate (O00O0000OO0O0OOO0 [OOO0OO0OOOOO00OOO ]):#line:103 if str (O00O0000OOOO0OO00 )=="maya":#line:104 O00O0000OOOO0OO00 ="malla"#line:105 if str (O00O0000OOOO0OO00 )=="pilos"or str (O00O0000OOOO0OO00 )=="pilo":#line:106 O00O0000OOOO0OO00 ="philo"#line:107 if str (O00O0000OOOO0OO00 )=="filos"or str (O00O0000OOOO0OO00 )=="filo":#line:108 O00O0000OOOO0OO00 ="philo"#line:109 if str (O00O0000OOOO0OO00 )=="sinces"or str (O00O0000OOOO0OO00 )=="sinc":#line:110 O00O0000OOOO0OO00 ="synthe"#line:111 if str (O00O0000OOOO0OO00 )=="sintes"or str (O00O0000OOOO0OO00 )=="sint":#line:112 O00O0000OOOO0OO00 ="synthe"#line:113 if str (O00O0000OOOO0OO00 )=="axos"or str (O00O0000OOOO0OO00 )=="axo":#line:114 O00O0000OOOO0OO00 ="axso"#line:115 if str (O00O0000OOOO0OO00 )=="uno":#line:116 O00O0000OOOO0OO00 ="1"#line:117 if str (O00O0000OOOO0OO00 )=="dos"or str (O00O0000OOOO0OO00 )=="do":#line:118 O00O0000OOOO0OO00 ="2"#line:119 if str (O00O0000OOOO0OO00 )=="tres"or str (O00O0000OOOO0OO00 )=="tr":#line:120 O00O0000OOOO0OO00 ="3"#line:121 if str (O00O0000OOOO0OO00 )=="cuatro":#line:122 O00O0000OOOO0OO00 ="4"#line:123 if str (O00O0000OOOO0OO00 )=="cinco":#line:124 O00O0000OOOO0OO00 ="5"#line:125 if str (O00O0000OOOO0OO00 )=="seis"or str (O00O0000OOOO0OO00 )=="sei":#line:126 O00O0000OOOO0OO00 ="6"#line:127 if str (O00O0000OOOO0OO00 )=="siete":#line:128 O00O0000OOOO0OO00 ="7"#line:129 if str (O00O0000OOOO0OO00 )=="ocho":#line:130 O00O0000OOOO0OO00 ="8"#line:131 if str (O00O0000OOOO0OO00 )=="nueve":#line:132 O00O0000OOOO0OO00 ="9"#line:133 if str (O00O0000OOOO0OO00 )=="cero":#line:134 O00O0000OOOO0OO00 ="0"#line:135 if str (O00O0000OOOO0OO00 )=="veintiuno":#line:136 O00O0000OOOO0OO00 ="21"#line:137 if str (O00O0000OOOO0OO00 )=="veinte":#line:138 O00O0000OOOO0OO00 ="20"#line:139 if str (O00O0000OOOO0OO00 )=="veintidos"or str (O00O0000OOOO0OO00 )=="veintido":#line:140 O00O0000OOOO0OO00 ="22"#line:141 if str (O00O0000OOOO0OO00 )=="veintitres"or str (O00O0000OOOO0OO00 )=="veintitre":#line:142 O00O0000OOOO0OO00 ="23"#line:143 if str (O00O0000OOOO0OO00 )=="veinticuatro":#line:144 O00O0000OOOO0OO00 ="24"#line:145 if str (O00O0000OOOO0OO00 )=="veinticinco":#line:146 O00O0000OOOO0OO00 ="25"#line:147 if str (O00O0000OOOO0OO00 )=="veintiseis"or str (O00O0000OOOO0OO00 )=="veintisei":#line:148 O00O0000OOOO0OO00 ="26"#line:149 if str (O00O0000OOOO0OO00 )=="veintisiete":#line:150 O00O0000OOOO0OO00 ="27"#line:151 if str (O00O0000OOOO0OO00 )=="veintiocho":#line:152 O00O0000OOOO0OO00 ="28"#line:153 if str (O00O0000OOOO0OO00 )=="veintinueve":#line:154 O00O0000OOOO0OO00 ="29"#line:155 if str (O00O0000OOOO0OO00 )=="treinta":#line:156 O00O0000OOOO0OO00 ="30"#line:157 if str (remove_accents (O000O0OO0OOOO00OO )).lower ()==str (remove_accents (O00O0000OOOO0OO00 )).lower ():#line:158 OOO00OO000O0O0O00 [OOO0OO0OOOOO00OOO ]=OOO00OO000O0O0O00 [OOO0OO0OOOOO00OOO ]+1 #line:159 O00O0000OO0O0OOO0 [OOO0OO0OOOOO00OOO ].pop (OOOOO0O0O0O00OO00 )#line:160 OOO00O0OOOO0O0OO0 =np .argwhere (OOO00OO000O0O0O00 ==np .amax (OOO00OO000O0O0O00 ))#line:162 O0000O0O00O0000OO =[]#line:163 OOOOO00OOO000OO0O ={}#line:164 OO0OOOO0000O00OO0 =[]#line:165 O0000OO0000O0000O =[]#line:166 O0O0O0O0000OOOOO0 =[]#line:167 O00OO0O00O000O00O =xlrd .open_workbook (archivo )#line:168 O00OO0O00O000O00O =O00OO0O00O000O00O .sheet_by_index (0 )#line:169 if not np .all (OOO00OO000O0O0O00 ==0 ):#line:170 for OO0O0OOO00OO000OO in OOO00O0OOOO0O0OO0 :#line:171 if (O0OOOOO0OO0OO0000 .loc [OO0O0OOO00OO000OO ,'Especialidad']=='trauma').any ():#line:172 OOO00000OOO0OOOO0 =O00OO0O00O000O00O .cell (int (OO0O0OOO00OO000OO )+1 ,2 )#line:173 OO00O00OO00O0OO0O =O00OO0O00O000O00O .cell (int (OO0O0OOO00OO000OO )+1 ,3 )#line:174 OOO00000OOO0OOOO0 =str (OOO00000OOO0OOOO0 )#line:175 OO00O00OO00O0OO0O =str (OO00O00OO00O0OO0O )#line:176 OOO00000OOO0OOOO0 =OOO00000OOO0OOOO0 .split ("'")#line:177 OO00O00OO00O0OO0O =OO00O00OO00O0OO0O .split ("'")#line:178 OO0OOOO0000O00OO0 .append (f" {OOO00000OOO0OOOO0[1]} {OO00O00OO00O0OO0O[1]} ")#line:179 elif (O0OOOOO0OO0OO0000 .loc [OO0O0OOO00OO000OO ,'Especialidad']=='uro').any ():#line:180 OOO00000OOO0OOOO0 =O00OO0O00O000O00O .cell (int (OO0O0OOO00OO000OO )+1 ,2 )#line:181 OO00O00OO00O0OO0O =O00OO0O00O000O00O .cell (int (OO0O0OOO00OO000OO )+1 ,3 )#line:182 OOO00000OOO0OOOO0 =str (OOO00000OOO0OOOO0 )#line:183 OO00O00OO00O0OO0O =str (OO00O00OO00O0OO0O )#line:184 OOO00000OOO0OOOO0 =OOO00000OOO0OOOO0 .split ("'")#line:185 OO00O00OO00O0OO0O =OO00O00OO00O0OO0O .split ("'")#line:186 O0000OO0000O0000O .append (f" {OOO00000OOO0OOOO0[1]} {OO00O00OO00O0OO0O[1]} ")#line:187 elif (O0OOOOO0OO0OO0000 .loc [OO0O0OOO00OO000OO ,'Especialidad']=='admin').any ():#line:188 OOO00000OOO0OOOO0 =O00OO0O00O000O00O .cell (int (OO0O0OOO00OO000OO )+1 ,2 )#line:189 OO00O00OO00O0OO0O =O00OO0O00O000O00O .cell (int (OO0O0OOO00OO000OO )+1 ,3 )#line:190 OOO00000OOO0OOOO0 =str (OOO00000OOO0OOOO0 )#line:191 OO00O00OO00O0OO0O =str (OO00O00OO00O0OO0O )#line:192 OOO00000OOO0OOOO0 =OOO00000OOO0OOOO0 .split ("'")#line:193 OO00O00OO00O0OO0O =OO00O00OO00O0OO0O .split ("'")#line:194 O0O0O0O0000OOOOO0 .append (f" {OOO00000OOO0OOOO0[1]} {OO00O00OO00O0OO0O[1]} ")#line:196 print (OO0OOOO0000O00OO0 )#line:197 OO0OOOO0000O00OO0 = [remove_non_printable(item) for item in OO0OOOO0000O00OO0] O0000OO0000O0000O = [remove_non_printable(item) for item in O0000OO0000O0000O] O0O0O0O0000OOOOO0 = [remove_non_printable(item) for item in O0O0O0O0000OOOOO0] #OO0OOOO0000O00OO0=OO0OOOO0000O00OO0.applymap(remove_non_printable) #O0000OO0000O0000O=O0000OO0000O0000O.applymap(remove_non_printable) #O0O0O0O0000OOOOO0=O0O0O0O0000OOOOO0.applymap(remove_non_printable) return OO0OOOO0000O00OO0 ,O0000OO0000O0000O ,O0O0O0O0000OOOOO0 #line:198 async def boton_pdf_video (OO0O0OOOOOOO00000 ,O00000O0O000O00O0 ,O00OOOOO00O0OOOO0 ):#line:200 O00OO000OO0O00OO0 =aiohttp .TCPConnector (ssl =True )#line:201 async with aiohttp .ClientSession (connector =O00OO000OO0O00OO0 )as OO0OO0OOOO000OOOO :#line:202 O0OOO00O0O00O0O0O =await OO0OO0OOOO000OOOO .get (f'{base_url}all-content/{OO0O0OOOOOOO00000}',auth =auth )#line:203 O0O0OO0O00O0O00O0 =await O0OOO00O0O00O0O0O .json ()#line:204 O0000000O000OO00O =[]#line:206 O0OOO0OO0OO0000OO ={}#line:207 if O00OOOOO00O0OOOO0 =="0":#line:209 for OOOOO00OO0OOO0OO0 in O0O0OO0O00O0O00O0 :#line:210 if OOOOO00OO0OOO0OO0 ['type']=="Intervencion":#line:211 O0000000O000OO00O .append (OOOOO00OO0OOO0OO0 ['nid'])#line:212 else :#line:213 O0000000O000OO00O .append (O00OOOOO00O0OOOO0 )#line:214 for O000OOOOO00OOO00O in O0000000O000OO00O :#line:216 OOOOOOOO00000000O =await OO0OO0OOOO000OOOO .get (f'{base_url}intervenciones/{O000OOOOO00OOO00O}',auth =auth )#line:217 OO0OO0OO00O00O00O =await OOOOOOOO00000000O .json ()#line:218 OO0OO0OO00O00O00O =OO0OO0OO00O00O00O [0 ]#line:219 O00O0O0000O0OO0O0 ={}#line:220 if O00000O0O000O00O0 in OO0OO0OO00O00O00O :#line:222 OO000OOO00O0OO0OO =OO0OO0OO00O00O00O [O00000O0O000O00O0 ]#line:223 for O0O0O000O0OOOO000 in OO000OOO00O0OO0OO :#line:224 if O00000O0O000O00O0 =='field_pdf':#line:225 O00O0O0000O0OO0O0 [O0O0O000O0OOOO000 ['descripcion']]="https://orva.tedcas.com/"+str (O0O0O000O0OOOO000 ['url'])#line:226 if O00000O0O000O00O0 =='field_video':#line:227 O00O0O0000O0OO0O0 [O0O0O000O0OOOO000 ['descripcion']]=str (O0O0O000O0OOOO000 ['url'])#line:228 O0OOO0OO0OO0000OO [OO0OO0OO00O00O00O ['title']]=O00O0O0000O0OO0O0 #line:230 else :#line:231 if O00OOOOO00O0OOOO0 =='0':#line:232 O00OOOOO00O0OOOO0 ='0'#line:233 else :#line:234 print ("nid dentro del if "+str (O00OOOOO00O0OOOO0 ))#line:235 O00O0O0000O0OO0O0 ["No hay archivos"]=""#line:236 O0OOO0OO0OO0000OO ["No hay archivos"]=O00O0O0000O0OO0O0 #line:237 return {}#line:238 return O0OOO0OO0OO0000OO #line:240 async def boton_word_ppt (O0O00O000O00OO000 ,O000OO0OO0O000000 ,O0O0O000OO00OOO0O ):#line:242 O0000O000O0O00O0O =aiohttp .TCPConnector (ssl =True )#line:243 async with aiohttp .ClientSession (connector =O0000O000O0O00O0O )as OOO00OOOO000O0OOO :#line:244 O0OOO00OOO00O0OO0 =await OOO00OOOO000O0OOO .get (f'{base_url}all-content/{O0O00O000O00OO000}',auth =auth )#line:245 O0OO0OOO00OO00O00 =await O0OOO00OOO00O0OO0 .json ()#line:246 OOO00OO0O0000OOO0 =[]#line:248 O0O0O00O0O00O0OO0 ={}#line:249 if O0O0O000OO00OOO0O =='0':#line:251 for OO0O000OOO00O00OO in O0OO0OOO00OO00O00 :#line:252 if OO0O000OOO00O00OO ['type']=="Intervencion":#line:253 OOO00OO0O0000OOO0 .append (OO0O000OOO00O00OO ['nid'])#line:254 else :#line:255 OOO00OO0O0000OOO0 .append (O0O0O000OO00OOO0O )#line:256 for O00OO0O0O0O0OOO00 in OOO00OO0O0000OOO0 :#line:258 OO0O0000OOO000OOO =await OOO00OOOO000O0OOO .get (f'{base_url}intervenciones/{O00OO0O0O0O0OOO00}',auth =auth )#line:259 O0O0000OO00OOOO00 =await OO0O0000OOO000OOO .json ()#line:260 O0O0000OO00OOOO00 =O0O0000OO00OOOO00 [0 ]#line:261 if len (O0O0000OO00OOOO00 [O000OO0OO0O000000 ])!=0 :#line:262 O0O0O00O0O00O0OO0 [O0O0000OO00OOOO00 ['title']]="https://orva.tedcas.com/"+str (O0O0000OO00OOOO00 [O000OO0OO0O000000 ])#line:263 if len (O0O0000OO00OOOO00 [O000OO0OO0O000000 ])==0 and O0O0O000OO00OOO0O !='0':#line:264 O0O0O00O0O00O0OO0 ["No hay archivos"]=""#line:265 return {}#line:266 return O0O0O00O0O00O0OO0 #line:268 async def boton_materiales (OOOOOO0O0OO00OO00 ,O000OOO000OOOO000 ):#line:270 O00O000OOO0O0000O =aiohttp .TCPConnector (ssl =True )#line:271 async with aiohttp .ClientSession (connector =O00O000OOO0O0000O )as OOO000000OOO0O000 :#line:272 O0OO0O0OO00O000O0 ={}#line:273 if O000OOO000OOOO000 =='0':#line:275 OOOOOO00OOOOOO0O0 =await OOO000000OOO0O000 .get (f'{base_url}listado_completo_cajas/{OOOOOO0O0OO00OO00}',auth =auth )#line:276 OO0OOO000OOO000O0 =await OOOOOO00OOOOOO0O0 .json ()#line:277 for O00OOO0000O00OO00 in OO0OOO000OOO000O0 :#line:278 O0OO0O0OO00O000O0 [O00OOO0000O00OO00 ['title']]=O00OOO0000O00OO00 ['nid']#line:279 O0OO0O0OO00O000O0 ['']="si hay"#line:280 else :#line:281 OOOOOO00OOOOOO0O0 =await OOO000000OOO0O000 .get (f'{base_url}intervenciones/{O000OOO000OOOO000}',auth =auth )#line:282 OO0OOO000OOO000O0 =await OOOOOO00OOOOOO0O0 .json ()#line:283 OO0OOO000OOO000O0 =OO0OOO000OOO000O0 [0 ]#line:284 if 'field_cajas'in OO0OOO000OOO000O0 :#line:285 OO0OOO000OOO000O0 =OO0OOO000OOO000O0 ['field_cajas']#line:286 for O00OOO0000O00OO00 in OO0OOO000OOO000O0 :#line:287 O0OO0O0OO00O000O0 [O00OOO0000O00OO00 ['caja']]=O00OOO0000O00OO00 ['id']#line:288 O0OO0O0OO00O000O0 ['']="si hay"#line:289 else :#line:290 if O000OOO000OOOO000 !=0 :#line:291 O0OO0O0OO00O000O0 ['']=""#line:292 return {}#line:293 return O0OO0O0OO00O000O0 #line:294 async def cargar_base_datos (O0OOO000O000OO0O0 ,O00OOO00OOO0OO000 ):#line:296 OOOO0O0OO0OO00OO0 =None #line:297 O0O0O0OOOOO00OOO0 =[]#line:298 OO0O00OO0OO00O0OO =aiohttp .TCPConnector (ssl =True )#line:299 async with aiohttp .ClientSession (connector =OO0O00OO0OO00O0OO )as OO0OO000OOO0O00OO :#line:300 OO0O00OO000O00O0O =await OO0OO000OOO0O00OO .get ('https://orva.tedcas.com/api/all-content/'+str (O00OOO00OOO0OO000 ),auth =auth )#line:301 OO0O0OO0OOOOOO000 =await OO0O00OO000O00O0O .json ()#line:302 OOOO00000O000O00O =np .zeros (len (OO0O0OO0OOOOOO000 ),dtype =int )#line:303 O00OO0OOOO0OO0O0O =[]#line:304 for O0O0OO0OOO0000OO0 in O0OOO000O000OO0O0 :#line:305 O0OOOO0O0OOOOOO00 =0 #line:306 for OO000OOO00O00OOO0 in range (100 ):#line:307 OO000OOO00O00OOO0 =OO000OOO00O00OOO0 /10 #line:308 if O0O0OO0OOO0000OO0 ==str (OO000OOO00O00OOO0 ):#line:309 O0O0OO0OOO0000OO0 =str (OO000OOO00O00OOO0 ).split ('.')#line:310 O00OO0OOOO0OO0O0O .append (O0O0OO0OOO0000OO0 )#line:311 O0OOOO0O0OOOOOO00 =O0OOOO0O0OOOOOO00 +1 #line:312 if O0O0OO0OOO0000OO0 =='con':#line:313 O0OOOO0O0OOOOOO00 =O0OOOO0O0OOOOOO00 +1 #line:314 if O0OOOO0O0OOOOOO00 ==0 :#line:315 O00OO0OOOO0OO0O0O .append (O0O0OO0OOO0000OO0 )#line:316 for O0O00O000O00OO0OO in range (len (OO0O0OO0OOOOOO000 )):#line:317 OOOO00O000OO000OO =0 #line:318 O00O00O00OOO0OOOO =OO0O0OO0OOOOOO000 [O0O00O000O00OO0OO ]#line:319 OO0O00OO00O0OOOO0 =str (O00O00O00OOO0OOOO ['title']).lower ()#line:320 OO0O00OO00O0OOOO0 =remove_accents (OO0O00OO00O0OOOO0 )#line:321 OO0O00OO00O0OOOO0 =OO0O00OO00O0OOOO0 .split (' ')#line:322 for O0O00O0OO0O00O000 ,O0000O0OO0OO000OO in enumerate (OO0O00OO00O0OOOO0 ):#line:323 for O0OO000OO0O0O00O0 ,O0OOO00O0O00OOOOO in enumerate (OO0O00OO00O0OOOO0 ):#line:324 if O0OO000OO0O0O00O0 !=O0O00O0OO0O00O000 :#line:325 if O0000O0OO0OO000OO ==O0OOO00O0O00OOOOO :#line:326 OO0O00OO00O0OOOO0 .pop (O0OO000OO0O0O00O0 )#line:327 for O0O00O0OO0O00O000 ,O0000O0OO0OO000OO in enumerate (OO0O00OO00O0OOOO0 ):#line:328 for OO000OOO00O00OOO0 in range (100 ):#line:329 OO000OOO00O00OOO0 =OO000OOO00O00OOO0 /10 #line:330 if O0000O0OO0OO000OO ==str (OO000OOO00O00OOO0 ):#line:331 O0000O0OO0OO000OO =str (OO000OOO00O00OOO0 ).split ('.')#line:332 OO0O00OO00O0OOOO0 .append (O0000O0OO0OO000OO )#line:333 for OOOO000000O00OOOO in O00OO0OOOO0OO0O0O :#line:334 if OOOO000000O00OOOO =="maya":#line:335 OOOO000000O00OOOO ="malla"#line:336 if OOOO000000O00OOOO =="pilos"or OOOO000000O00OOOO =="pilo":#line:337 OOOO000000O00OOOO ="philo"#line:338 if OOOO000000O00OOOO =="filos"or OOOO000000O00OOOO =="filo":#line:339 OOOO000000O00OOOO ="philo"#line:340 if OOOO000000O00OOOO =="sinces"or OOOO000000O00OOOO =="sinc":#line:341 OOOO000000O00OOOO ="synthe"#line:342 if OOOO000000O00OOOO =="sintes"or OOOO000000O00OOOO =="sint":#line:343 OOOO000000O00OOOO ="synthe"#line:344 if OOOO000000O00OOOO =="axos"or OOOO000000O00OOOO =="axo":#line:345 OOOO000000O00OOOO ="axso"#line:346 if OOOO000000O00OOOO =="uno":#line:347 OOOO000000O00OOOO =1 #line:348 if OOOO000000O00OOOO =="dos"or OOOO000000O00OOOO =="do":#line:349 OOOO000000O00OOOO =2 #line:350 if OOOO000000O00OOOO =="tres"or OOOO000000O00OOOO =="tr":#line:351 OOOO000000O00OOOO =3 #line:352 if OOOO000000O00OOOO =="cuatro":#line:353 OOOO000000O00OOOO =4 #line:354 if OOOO000000O00OOOO =="cinco":#line:355 OOOO000000O00OOOO =5 #line:356 if OOOO000000O00OOOO =="seis"or OOOO000000O00OOOO =="sei":#line:357 OOOO000000O00OOOO =6 #line:358 if OOOO000000O00OOOO =="siete":#line:359 OOOO000000O00OOOO =7 #line:360 if OOOO000000O00OOOO =="ocho":#line:361 OOOO000000O00OOOO =8 #line:362 if OOOO000000O00OOOO =="nueve":#line:363 OOOO000000O00OOOO =9 #line:364 if OOOO000000O00OOOO =="cero":#line:365 OOOO000000O00OOOO =0 #line:366 if OOOO000000O00OOOO =="veintiuno":#line:367 OOOO000000O00OOOO ="21"#line:368 if OOOO000000O00OOOO =="veinte":#line:369 OOOO000000O00OOOO ="20"#line:370 if OOOO000000O00OOOO =="veintidos"or OOOO000000O00OOOO =="veintido":#line:371 OOOO000000O00OOOO ="22"#line:372 if OOOO000000O00OOOO =="veintitres"or OOOO000000O00OOOO =="veintitre":#line:373 OOOO000000O00OOOO ="23"#line:374 if OOOO000000O00OOOO =="veinticuatro":#line:375 OOOO000000O00OOOO ="24"#line:376 if OOOO000000O00OOOO =="veinticinco":#line:377 OOOO000000O00OOOO ="25"#line:378 if OOOO000000O00OOOO =="veintiseis"or OOOO000000O00OOOO =="veintisei":#line:379 OOOO000000O00OOOO ="26"#line:380 if OOOO000000O00OOOO =="veintisiete":#line:381 OOOO000000O00OOOO ="27"#line:382 if OOOO000000O00OOOO =="veintiocho":#line:383 OOOO000000O00OOOO ="28"#line:384 if OOOO000000O00OOOO =="veintinueve":#line:385 OOOO000000O00OOOO ="29"#line:386 if OOOO000000O00OOOO =="treinta":#line:387 OOOO000000O00OOOO ="30"#line:388 if type (OOOO000000O00OOOO )==int and type (OOOO0O0OO0OO00OO0 )==int :#line:389 OO000OOO00O00OOO0 =str (OOOO0O0OO0OO00OO0 )+'.'+str (OOOO000000O00OOOO )#line:390 OOOO000000O00OOOO =OO000OOO00O00OOO0 .split ('.')#line:391 OOOO0O0OO0OO00OO0 =OOOO000000O00OOOO #line:392 OOOO000000O00OOOO =inflector .singularize (str (OOOO000000O00OOOO ))#line:393 O0000O0OO0OO000OO =inflector .singularize (str (O0000O0OO0OO000OO ))#line:394 OOOO000000O00OOOO =remove_accents (OOOO000000O00OOOO )#line:395 if O0000O0OO0OO000OO ==OOOO000000O00OOOO :#line:396 OOOO00O000OO000OO =OOOO00O000OO000OO +1 #line:397 OOOO00000O000O00O [O0O00O000O00OO0OO ]=OOOO00O000OO000OO #line:398 OO00OOO0OOO0OO0OO =np .argwhere (OOOO00000O000O00O ==np .amax (OOOO00000O000O00O ))#line:399 for O0O00O000O00OO0OO in OO00OOO0OOO0OO0OO :#line:400 O0O0O0OOOOO00OOO0 .append (OO0O0OO0OOOOOO000 [int (O0O00O000O00OO0OO )])#line:401 if np .all (OOOO00000O000O00O ==0 ):#line:402 O0O0O0OOOOO00OOO0 =None #line:403 return O0O0O0OOOOO00OOO0 #line:404 async def cargar_tipo (O00O0O00OOOO000OO ,OO000OOO000OOOO00 ):#line:406 O0O0O00O000O0000O =aiohttp .TCPConnector (ssl =True )#line:407 async with aiohttp .ClientSession (connector =O0O0O00O000O0000O )as OO0OOO0O0OO0O00OO :#line:408 O0000000O0O00O0O0 =await OO0OOO0O0OO0O00OO .get (f'{base_url}all-content/{OO000OOO000OOOO00}',auth =auth )#line:409 O0O0O0O0OOOO0O000 =await O0000000O0O00O0O0 .json ()#line:410 O0OO00O0O0OO0OOO0 =None #line:411 O00O0O000O0O00000 =None #line:412 for OO0O0O0000O00OOOO in O0O0O0O0OOOO0O000 :#line:413 if O00O0O00OOOO000OO ==OO0O0O0000O00OOOO ["nid"]:#line:414 O0OO00O0O0OO0OOO0 =OO0O0O0000O00OOOO ["type"]#line:415 O00O0O000O0O00000 =OO0O0O0000O00OOOO #line:416 break #line:417 return O00O0O000O0O00000 ,O0OO00O0O0OO0OOO0 #line:418 async def cargar_archivo (O0OO000OO000O0OOO ,O00O000O0000OO000 ,OOOO0OOO0O00OOOO0 ):#line:420 O0O0OO00OO0O0O000 =[]#line:421 O0O0000000O00OOOO =aiohttp .TCPConnector (ssl =True )#line:422 async with aiohttp .ClientSession (connector =O0O0000000O00OOOO )as OO0OOOOO0OOO00OO0 :#line:423 O0O0O0O000O0000OO =await OO0OOOOO0OOO00OO0 .get ('https://orva.tedcas.com/api/'+str (OOOO0OOO0O00OOOO0 ),auth =auth )#line:424 OO0O000OO0O0O0000 =await O0O0O0O000O0000OO .json ()#line:425 OO0O000OO0O0O0000 =OO0O000OO0O0O0000 [0 ]#line:426 OOOO0000O00OO0000 ="field_"+str (O0OO000OO000O0OOO )#line:427 O0O0O0O0OOO00O0O0 =OO0O000OO0O0O0000 [OOOO0000O00OO0000 ]#line:428 if OOOO0000O00OO0000 =="field_image":#line:429 OO0O000OO0O0O0000 =OO0O000OO0O0O0000 ['field_image']#line:430 OO0O000OO0O0O0000 =OO0O000OO0O0O0000 .split (',')#line:431 OO0O000OO0O0O0000 =[O0O00OO000OO0O00O .replace (' ','')for O0O00OO000OO0O00O in OO0O000OO0O0O0000 ]#line:432 for OO0OOO0O0O000O0O0 in OO0O000OO0O0O0000 :#line:433 O0O0OO00OO0O0O000 .append ("https://orva.tedcas.com/"+str (OO0OOO0O0O000O0O0 ))#line:434 print (O0O0OO00OO0O0O000 )#line:435 return O0O0OO00OO0O0O000 #line:436 if len (O0O0O0O0OOO00O0O0 )==0 :#line:437 O0OOOO0O0O0OOOO0O ="No hay archivos subidos"#line:438 O0O0OO00OO0O0O000 ="templates/especialidad"#line:439 elif type (O0O0O0O0OOO00O0O0 )==str :#line:440 O0O0OO00OO0O0O000 ="https://orva.tedcas.com/"+str (O0O0O0O0OOO00O0O0 )#line:441 O0OOOO0O0O0OOOO0O =O0O0O0O0OOO00O0O0 #line:442 elif type (O0O0O0O0OOO00O0O0 )==list :#line:443 for OOOO0OO0OOO0OOOO0 ,O0000OO00OO0O0O0O in O0O0O0O0OOO00O0O0 :#line:444 O0O0OO00OO0O0O000 [OOOO0OO0OOO0OOOO0 ]="https://orva.tedcas.com/"+str (O0000OO00OO0O0O0O )#line:445 O0OOOO0O0O0OOOO0O =O0O0O0O0OOO00O0O0 #line:446 return O00O000O0000OO000 ,O0O0OO00OO0O0O000 ,O0OOOO0O0O0OOOO0O #line:447 async def cargar_archivo_grande (OOO0OOO00OOOOO0O0 ,OOO0000000OO0OO00 ,OO0OOOO0O0OO000OO ):#line:449 O0OO0000O0O0OO00O =aiohttp .TCPConnector (ssl =True )#line:450 async with aiohttp .ClientSession (connector =O0OO0000O0O0OO00O )as O000O0O00O000O0OO :#line:451 O000OO00OO000O0OO =await O000O0O00O000O0OO .get ('https://orva.tedcas.com/api/'+str (OO0OOOO0O0OO000OO ),auth =auth )#line:452 O00O000O0000O0O00 =await O000OO00OO000O0OO .json ()#line:453 O00O0OO0000O0000O ={}#line:454 if OOO0OOO00OOOOO0O0 =='title_material':#line:455 for OOO0O0O0O0OOOO000 in O00O000O0000O0O00 :#line:456 O00O0OO0000O0000O [OOO0O0O0O0OOOO000 [OOO0OOO00OOOOO0O0 ]]=(OOO0O0O0O0OOOO000 [OOO0OOO00OOOOO0O0 ])#line:457 return O00O0OO0000O0000O ,OOO0000000OO0OO00 #line:458 O00O000O0000O0O00 =O00O000O0000O0O00 [0 ]#line:459 OOO0OOOO0O0O00000 ="field_"+str (OOO0OOO00OOOOO0O0 )#line:460 OOO0OOOO0O0O00000 =O00O000O0000O0O00 [OOO0OOOO0O0O00000 ]#line:461 if len (OOO0OOOO0O0O00000 )==0 :#line:462 O00O0OO0000O0000O ["No hay archivos"]="templates/especialidad"#line:463 else :#line:464 for OOO0O0O0O0OOOO000 in OOO0OOOO0O0O00000 :#line:465 O00O0OO0000O0000O [OOO0O0O0O0OOOO000 ['descripcion']]="https://orva.tedcas.com/"+str (OOO0O0O0O0OOOO000 ['url'])#line:466 return OOO0000000OO0OO00 ,O00O0OO0000O0000O #line:467 async def cargar_caja (O00O0O0OO000O0OO0 ,O0O0000000OO000OO ):#line:469 OO0O0O0OOOOO00OOO ={}#line:470 OOOOO0OOO0O0OOO00 =aiohttp .TCPConnector (ssl =True )#line:471 async with aiohttp .ClientSession (connector =OOOOO0OOO0O0OOO00 )as O00O00OOOO0OOO00O :#line:472 OO0OO00OOO0OOO0OO =await O00O00OOOO0OOO00O .get (f'{base_url}intervenciones/{O00O0O0OO000O0OO0}',auth =auth )#line:473 OOO0O0OOOO0OOOO00 =await OO0OO00OOO0OOO0OO .json ()#line:474 OOO0O0OOOO0OOOO00 =OOO0O0OOOO0OOOO00 [0 ]#line:475 if 'field_cajas'in OOO0O0OOOO0OOOO00 :#line:476 OOO0O0OOOO0OOOO00 =OOO0O0OOOO0OOOO00 ['field_cajas']#line:477 for OO00O0O00000O0OO0 in OOO0O0OOOO0OOOO00 :#line:478 OO0O0O0OOOOO00OOO [OO00O0O00000O0OO0 ['id']]=OO00O0O00000O0OO0 ['caja']#line:479 else :#line:480 OO0O0O0OOOOO00OOO [str (O00O0O0OO000O0OO0 )]="No hay archivos"#line:481 return OO0O0O0OOOOO00OOO ,O0O0000000OO000OO #line:482 async def cargar_instrumental (O0OO0OO00O0O00000 ,OO0O0OO0O00O00OOO ):#line:484 O0OO0O0000O000000 ={}#line:485 O00O00O00OO0O0O00 =aiohttp .TCPConnector (ssl =True )#line:486 async with aiohttp .ClientSession (connector =O00O00O00OO0O0O00 )as O00O0OOO0O00O0OO0 :#line:487 OOO00O0OO00000O0O =await O00O0OOO0O00O0OO0 .get ('https://orva.tedcas.com/api/'+str (OO0O0OO0O00O00OOO ),auth =auth )#line:488 O0000OOOOOOOOO0OO =await OOO00O0OO00000O0O .json ()#line:489 for O00O000O00O000OOO in O0000OOOOOOOOO0OO :#line:490 if 'instrumental'in O00O000O00O000OOO :#line:491 for O00000O0O00O0O0OO in O00O000O00O000OOO ['instrumental']:#line:492 if O00000O0O00O0O0OO ['id']==O0OO0OO00O0O00000 :#line:493 O0OO0O0000O000000 [O00O000O00O000OOO ['nid']]=O00O000O00O000OOO ['title']#line:494 return O0OO0O0000O000000 #line:495 async def cargar_botones_pdf_admision ():#line:497 O0O000O00O0OOO000 ={}#line:498 O00O00O00000O0OOO ={}#line:499 OO00OOO0OO000OOO0 ={}#line:500 OO0000OO00O000O00 ={}#line:501 O00OO000OO0000OO0 =aiohttp .TCPConnector (ssl =True )#line:502 async with aiohttp .ClientSession (connector =O00OO000OO0000OO0 )as O0OOOO0OOO0O00000 :#line:503 OO0OO0OOOOO0OO0OO =await O0OOOO0OOO0O00000 .get ('https://orva.tedcas.com/api/all-content/1621',auth =auth )#line:504 O00O000OOO0O0O00O =await OO0OO0OOOOO0OO0OO .json ()#line:505 for O0O0OO00OOOO00OO0 in O00O000OOO0O0O00O :#line:506 O000OO00OO0O00OOO =await O0OOOO0OOO0O00000 .get ('https://orva.tedcas.com/api/intervenciones/'+str (O0O0OO00OOOO00OO0 ['nid']),auth =auth )#line:507 O000OOOOO00O00OO0 =await O000OO00OO0O00OOO .json ()#line:508 O000OOOOO00O00OO0 =O000OOOOO00O00OO0 [0 ]#line:509 OO0O00O00O00000O0 =O000OOOOO00O00OO0 ['field_pdf']#line:510 OO0O00O00O00000O0 =OO0O00O00O00000O0 [0 ]#line:511 if O000OOOOO00O00OO0 ['field_tecnica']=="Mapa de camas":#line:512 O0O000O00O0OOO000 [O000OOOOO00O00OO0 ['title']]="https://orva.tedcas.com/"+str (OO0O00O00O00000O0 ['url'])#line:513 elif O000OOOOO00O00OO0 ['field_tecnica']=="Ambulancias":#line:514 O00O00O00000O0OOO [O000OOOOO00O00OO0 ['title']]="https://orva.tedcas.com/"+str (OO0O00O00O00000O0 ['url'])#line:515 elif O000OOOOO00O00OO0 ['field_tecnica']=="Programación quirúrgica":#line:516 OO00OOO0OO000OOO0 [O000OOOOO00O00OO0 ['title']]="https://orva.tedcas.com/"+str (OO0O00O00O00000O0 ['url'])#line:517 elif O000OOOOO00O00OO0 ['field_tecnica']=="Otros":#line:518 OO0000OO00O000O00 [O000OOOOO00O00OO0 ['title']]="https://orva.tedcas.com/"+str (OO0O00O00O00000O0 ['url'])#line:519 return O0O000O00O0OOO000 ,O00O00O00000O0OOO ,OO00OOO0OO000OOO0 ,OO0000OO00O000O00 #line:520 def remove_accents (OOOOOOO0O0OOO0OOO ):#line:522 OOOO00000000OOO0O =unicodedata .normalize ('NFKD',OOOOOOO0O0OOO0OOO )#line:523 return u"".join ([O000000O0O0O0OOO0 for O000000O0O0O0OOO0 in OOOO00000000OOO0O if not unicodedata .combining (O000000O0O0O0OOO0 )])#line:524 def adaptar_salida (O0O0OO0OO0O0O000O ):#line:526 O0OO00O00O00OOOO0 =[]#line:527 O0O0OO0OO0O0O000O =str (O0O0OO0OO0O0O000O ).lower ()#line:528 O0O0OO0OO0O0O000O =O0O0OO0OO0O0O000O .split ("}")#line:529 O0O0OO0OO0O0O000O =O0O0OO0OO0O0O000O [0 ].split (":")#line:530 if len (O0O0OO0OO0O0O000O )>=2 :#line:531 OO0OO00OOOO0O0O00 =O0O0OO0OO0O0O000O [1 ].split ("'")#line:532 O0OO00O00O00OOOO0 =OO0OO00OOOO0O0O00 [1 ].split ()#line:533 return O0OO00O00O00OOOO0 #line:534 def takeCommand ():#line:536 O0OOOOOOO0O00OO00 =sr .Recognizer ()#line:537 with sr .Microphone ()as OO00OO0O0O00OO000 :#line:538 print ("Listening...")#line:539 O0OOOOOOO0O00OO00 .pause_threshold =1 #line:540 OO0O0OOOO0OOOOOO0 =O0OOOOOOO0O00OO00 .adjust_for_ambient_noise (OO00OO0O0O00OO000 )#line:541 OO0O0OOOO0OOOOOO0 =O0OOOOOOO0O00OO00 .listen (OO00OO0O0O00OO000 )#line:542 try :#line:543 print ("Recognizing...")#line:544 OO00O00OOO0OOOOOO =O0OOOOOOO0O00OO00 .recognize_google (OO0O0OOOO0OOOOOO0 ,language ='es-ES')#line:545 print (f"User said: {OO00O00OOO0OOOOOO}\n")#line:546 except Exception as OOO0OO0OOO0OOO00O :#line:547 print (OOO0OO0OOO0OOO00O )#line:548 print ("Unable to Recognize your voice.")#line:549 return "none"#line:550 return OO00O00OOO0OOOOOO #line:580 app =Flask (__name__ )#line:582 app .config ['SECRET_KEY']='mysecretkey'#line:583 IMG_FOLDER =os .path .join ('static','IMG')#line:585 app .config ['UPLOAD_FOLDER']=IMG_FOLDER #line:586 @app .route ("/")#line:588 async def hello ():#line:589 O0OOO0OOO0000OOOO =os .path .join (app .config ['UPLOAD_FOLDER'],'trauma.jpeg')#line:590 O0O0OO0OO0000O0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'uro.jpeg')#line:591 OO00OOOO0OOO0OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'adm.jpeg')#line:592 O00O0O0O0OOOO000O =os .path .join (app .config ['UPLOAD_FOLDER'],'tijerass.png')#line:593 return render_template ('especialidad.html',user_image0 =O00O0O0O0OOOO000O ,user_image1 =O0OOO0OOO0000OOOO ,user_image2 =O0O0OO0OO0000O0O0 ,user_image3 =OO00OOOO0OOO0OOO0 )#line:594 @app .route ("/especialidad")#line:596 async def especialidad ():#line:597 O0O0O0O0O0OOOOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'trauma.jpeg')#line:598 OO0O00OOO0O000O0O =os .path .join (app .config ['UPLOAD_FOLDER'],'uro.jpeg')#line:599 OOO00O0O0O000O0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'adm.jpeg')#line:600 OO00OOOOOO0O0O0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'tijerass.png')#line:601 return render_template ('especialidad.html',user_image0 =OO00OOOOOO0O0O0O0 ,user_image1 =O0O0O0O0O0OOOOOO0 ,user_image2 =OO0O00OOO0O000O0O ,user_image3 =OOO00O0O0O000O0OO )#line:602 @app .route ("/preguntas_respuestas_trauma",methods =['GET','POST'])#line:604 async def preguntas_respuestas_trauma ():#line:605 OO000OOO000O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:606 OO00O0OO0O000O0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:607 O0OO0O00O00O0OOOO ,O0OOOO000O0OOOO00 ,O00OOOOOOOOO0O000 =await faq ()#line:608 return render_template ('preguntas_respuestas.html',user_image6 =OO000OOO000O00O00 ,user_image7 =OO00O0OO0O000O0OO ,faqs =O0OO0O00O00O0OOOO ,faq_titulo ="Preguntas y respuestas: ")#line:609 @app .route ("/preguntas_respuestas_uro",methods =['GET','POST'])#line:611 async def preguntas_respuestas_uro ():#line:612 OO000000O0OO00OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:613 O0OOOO0OOO00OOO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:614 OOO000O0O00OOOO00 ,OOOOO0O00OO00OO0O ,O00O0OOOOO0O0OOOO =await faq ()#line:615 return render_template ('preguntas_respuestas.html',user_image6 =OO000000O0OO00OO0 ,user_image7 =O0OOOO0OOO00OOO00 ,faqs =OOOOO0O00OO00OO0O ,faq_titulo ="Preguntas y respuestas: ")#line:616 @app .route ("/preguntas_respuestas_admin",methods =['GET','POST'])#line:618 async def preguntas_respuestas_admin ():#line:619 O0OOOOO00O00000O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:620 OO0OO000000O00OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:621 O0O0OO00OO00OOOOO ,O0O0O000O0OO0O0OO ,OOOO000000OO0000O =await faq ()#line:622 return render_template ('preguntas_respuestas.html',user_image6 =O0OOOOO00O00000O0 ,user_image7 =OO0OO000000O00OOO ,faqs =OOOO000000OO0000O ,faq_titulo ="Preguntas y respuestas: ")#line:623 @app .route ("/seleccion_trauma",methods =['GET','POST'])#line:625 async def seleccion_trauma ():#line:626 O0000O0OOO00OO00O =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:627 OO00O0OO0O000OO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:628 OOO000O0OOO00O0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:629 O00O00O0OO0OO000O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:630 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') return render_template ('seleccion_trauma.html',abrir=abrir, user_image4 =O0000O0OOO00OO00O ,user_image5 =OO00O0OO0O000OO00 ,user_image6 =OOO000O0OOO00O0OO ,user_image7 =O00O00O0OO0OO000O )#line:631 @app .route ("/buscador_trauma",methods =['GET','POST'])#line:633 async def buscador_trauma ():#line:634 O00O000OO0O000OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:635 OOO000OO0OO0OO000 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:636 OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:637 O0OOOOOO0OO0OO00O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:638 OO000OO0OOO00OO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:639 OO00OO0OO0O0O0OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:640 OOOO00O0O0OOO0OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:641 O0O00OOOO00O0000O =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:642 O0OOO0O0O00OOO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'preguntas_respuestas.png')#line:643 OO0OO0OOO0O0OO0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:644 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OOOO0OOO0OO0OOO0O =str (request .form .to_dict ())#line:645 OOOO0OOO0OO0OOO0O =adaptar_salida (OOOO0OOO0OO0OOO0O )#line:646 OO0O000O00O00O0OO ={}#line:647 OO0O000O00O00O0OO [""]=""#line:648 if len (OOOO0OOO0OO0OOO0O )==0 :#line:649 return render_template ('buscador_trauma.html',abrir=abrir, preguntas_respuestas =O0OOO0O0O00OOO0O0 ,result_busqueda =OO0O000O00O00O0OO ,user_image4 =O00O000OO0O000OO0 ,user_image5 =OOO000OO0OO0OO000 ,user_image6 =OOO0000OOO000OOO0 ,user_image7 =O0OOOOOO0OO0OO00O ,user_image8 =OOOO00O0O0OOO0OO0 ,user_image9 =O0O00OOOO00O0000O ,user_image10 =OO000OO0OOO00OO00 ,user_image11 =OO0OO0OOO0O0OO0OO ,user_image12 =OO00OO0OO0O0O0OO0 ,nid2 =0 )#line:650 elif OOOO0OOO0OO0OOO0O !=None or "{}":#line:651 O0O0O00OO0OOOOO00 =1 #line:652 OOO000OOO00OO000O =await cargar_base_datos (OOOO0OOO0OO0OOO0O ,O0O0O00OO0OOOOO00 )#line:653 O0OOO0OO00OO0OOO0 ,O00O00O0OOOOO00O0 ,O0O00O00OO00OO0O0 =await buscar_faq (OOOO0OOO0OO0OOO0O ,1 )#line:654 if OOO000OOO00OO000O ==None :#line:655 if len (O0OOO0OO00OO0OOO0 )==0 :#line:656 return render_template ('buscador_trauma.html', preguntas_respuestas =O0OOO0O0O00OOO0O0 ,result_busqueda =OO0O000O00O00O0OO ,prediction_text ="No hay resultados para tu busqueda",user_image4 =O00O000OO0O000OO0 ,user_image5 =OOO000OO0OO0OO000 ,user_image6 =OOO0000OOO000OOO0 ,user_image7 =O0OOOOOO0OO0OO00O ,user_image8 =OOOO00O0O0OOO0OO0 ,user_image9 =O0O00OOOO00O0000O ,user_image10 =OO000OO0OOO00OO00 ,user_image11 =OO0OO0OOO0O0OO0OO ,user_image12 =OO00OO0OO0O0O0OO0 ,nid2 =0 )#line:657 else :#line:658 return render_template ('buscador_trauma.html', preguntas_respuestas =O0OOO0O0O00OOO0O0 ,faqs =O0OOO0OO00OO0OOO0 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =OO0O000O00O00O0OO ,user_image4 =O00O000OO0O000OO0 ,user_image5 =OOO000OO0OO0OO000 ,user_image6 =OOO0000OOO000OOO0 ,user_image7 =O0OOOOOO0OO0OO00O ,user_image8 =OOOO00O0O0OOO0OO0 ,user_image9 =O0O00OOOO00O0000O ,user_image10 =OO000OO0OOO00OO00 ,user_image11 =OO0OO0OOO0O0OO0OO ,user_image12 =OO00OO0OO0O0O0OO0 ,nid2 =0 )#line:659 elif len (OOO000OOO00OO000O )>=1 :#line:660 OO00OOO0OOO0O0000 =[]#line:661 O00OO0OOOOOO0OOO0 =[]#line:662 OO0O000O00O00O0OO ={}#line:663 for OO0O0OO000OOOOOO0 in OOO000OOO00OO000O :#line:664 OO00OOO0OOO0O0000 .append (OO0O0OO000OOOOOO0 ["title"])#line:665 O00OO0OOOOOO0OOO0 .append (OO0O0OO000OOOOOO0 ["nid"])#line:666 for O0O0OOO0OOO0O00OO ,OO0O0OO000OOOOOO0 in enumerate (OO00OOO0OOO0O0000 ):#line:667 OO0O000O00O00O0OO [O00OO0OOOOOO0OOO0 [O0O0OOO0OOO0O00OO ]]=OO0O0OO000OOOOOO0 #line:668 if len (O0OOO0OO00OO0OOO0 )!=0 :#line:670 return render_template ('buscador_trauma1.html',abrir=abrir, faqs =O0OOO0OO00OO0OOO0 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =OO0O000O00O00O0OO ,user_image4 =O00O000OO0O000OO0 ,user_image5 =OOO000OO0OO0OO000 ,user_image6 =OOO0000OOO000OOO0 ,user_image7 =O0OOOOOO0OO0OO00O ,user_image8 =OOOO00O0O0OOO0OO0 ,user_image9 =O0O00OOOO00O0000O ,user_image10 =OO000OO0OOO00OO00 ,user_image11 =OO0OO0OOO0O0OO0OO ,user_image12 =OO00OO0OO0O0O0OO0 ,nid2 =0 )#line:671 else :#line:672 if len(OO0O000O00O00O0OO)==1: return redirect(url_for('resultado_trauma',link=O00OO0OOOOOO0OOO0)) else: return render_template ('buscador_trauma1.html',abrir=abrir, result_busqueda =OO0O000O00O00O0OO ,user_image4 =O00O000OO0O000OO0 ,user_image5 =OOO000OO0OO0OO000 ,user_image6 =OOO0000OOO000OOO0 ,user_image7 =O0OOOOOO0OO0OO00O ,user_image8 =OOOO00O0O0OOO0OO0 ,user_image9 =O0O00OOOO00O0000O ,user_image10 =OO000OO0OOO00OO00 ,user_image11 =OO0OO0OOO0O0OO0OO ,user_image12 =OO00OO0OO0O0O0OO0 ,nid2 =0 )#line:673 @app .route ("/resultado_trauma",methods =['GET','POST'])#line:675 async def resultado_trauma ():#line:676 OO00OOO00OO00O000 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:677 OOO00O000OOOO0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:678 OO000000O00OO0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:679 OO0OOO0000OOO0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:680 O000OOO0O00OO0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:681 OO0O00OOO000O0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:682 OOOO00000O00O000O =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:683 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OOOO00O0OO00OOOOO =request .args .get ('link')#line:684 OOOOOOOO0O00000OO ,O0OO0O0000000O00O =await cargar_tipo (OOOO00O0OO00OOOOO ,1 )#line:685 OOO0OOOO00OO00O0O =OOOOOOOO0O00000OO ['title']#line:686 if O0OO0O0000000O00O =="Intervencion":#line:688 O0O0OO0OO000OOO00 ,O00O0O0OOOO00OOO0 =await cargar_caja (str (OOOO00O0OO00OOOOO ),'Instrumental - Cajas: ')#line:689 return render_template ('intervencion_trauma.html',abrir=abrir, user_image8 =O000OOO0O00OO0O00 ,user_image9 =OO0O00OOO000O0000 ,user_image10 =OO000000O00OO0000 ,user_image11 =OOOO00000O00O000O ,user_image12 =OO0OOO0000OOO0000 ,instrumental =O0O0OO0OO000OOO00 ,texto_cajas =O00O0O0OOOO00OOO0 ,title =OOO0OOOO00OO00O0O ,user_image6 =OO00OOO00OO00O000 ,user_image7 =OOO00O000OOOO0000 ,nid2 =OOOO00O0OO00OOOOO )#line:690 elif O0OO0O0000000O00O =='Caja':#line:691 OOOO000O0000O00O0 ,O0OOO00O00000OO0O ,O0OOOO0O0O0000O00 =await cargar_archivo ("ubicacion","Ubicacion: ","cajas/"+str (OOOO00O0OO00OOOOO ))#line:692 OO0OO0OOOOOOOOO00 =await cargar_archivo ("image","Imagen: ","cajas/"+str (OOOO00O0OO00OOOOO ))#line:693 O00000O0O000O0O00 ,OOOO0O00O000OOOOO =await cargar_archivo_grande ("title_material","Instrumental : ","cajas/"+str (OOOO00O0OO00OOOOO ))#line:694 return render_template ('caja_trauma.html',abrir=abrir, title =OOO0OOOO00OO00O0O ,files_instru =O00000O0O000O0O00 ,texto_instru =OOOO0O00O000OOOOO ,texto_ubi =OOOO000O0000O00O0 ,file_texto_ubi =O0OOOO0O0O0000O00 ,file_imagen =OO0OO0OOOOOOOOO00 ,user_image6 =OO00OOO00OO00O000 ,user_image7 =OOO00O000OOOO0000 )#line:698 elif O0OO0O0000000O00O =='Instrumental':#line:699 OO00O0OOOOO0OO00O =await cargar_instrumental (OOOO00O0OO00OOOOO ,'listado_completo_cajas/1')#line:700 return render_template ('instrumental_trauma.html',abrir=abrir, cajas =OO00O0OOOOO0OO00O ,texto ='El instrumental que buscas esta presente en las siguientes cajas: ',title =OOO0OOOO00OO00O0O ,user_image6 =OO00OOO00OO00O000 ,user_image7 =OOO00O000OOOO0000 )#line:704 @app .route ("/protocolos_trauma",methods =['GET','POST'])#line:706 async def protocolos_trauma ():#line:707 OO0000000O0OO0O0O =request .args .get ('link2')#line:708 O0OOO000OO00O0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:709 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OO000OOO000O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') OO00O0000OO0O0000 =await boton_word_ppt (1 ,"field_protocolo",OO0000000O0OO0O0O )#line:710 if len (OO00O0000OO0O0000 )==1 :#line:711 return render_template ('protocolo1.html',user_image6 =OO000OOO000O00O00,abrir=abrir, protocolos =OO00O0000OO0O0000 ,user_image7 =O0OOO000OO00O0O00 )#line:712 else :#line:713 return render_template ('protocolo.html',user_image6 =OO000OOO000O00O00,abrir=abrir, protocolos =OO00O0000OO0O0000 ,user_image7 =O0OOO000OO00O0O00 )#line:714 @app .route ("/guia_visual_trauma",methods =['GET','POST'])#line:716 async def guia_visual_trauma ():#line:717 OO0O0OO000OO000OO =request .args .get ('link2')#line:718 O0O000OO0000O00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:719 OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0O00000000O0OOOO =await boton_word_ppt (1 ,"field_guia_visual",OO0O0OO000OO000OO )#line:720 if len (O0O00000000O0OOOO )==1 :#line:721 return render_template ('guia_visual1.html',abrir= abrir, user_image6 =OOO0000OOO000OOO0, guia_visual =O0O00000000O0OOOO ,user_image7 =O0O000OO0000O00O0 )#line:722 else :#line:723 return render_template ('guia_visual.html',abrir= abrir, user_image6 =OOO0000OOO000OOO0, guia_visual =O0O00000000O0OOOO ,user_image7 =O0O000OO0000O00O0 )#line:724 @app .route ("/pdf_casa_trauma",methods =['GET','POST'])#line:726 async def pdf_casa_trauma ():#line:727 O000OOO0OOO000000 =request .args .get ('link2')#line:728 O0000000OO0000O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:729 OO000OOO000O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OO000OO00O0000000 =await boton_pdf_video (1 ,"field_pdf",O000OOO0OOO000000 )#line:730 O0O00O0O0OOOO0OOO =0 #line:731 for OO0O00OO0O0OO00O0 ,OO0O0OOOO0OO0OO0O in OO000OO00O0000000 .items ():#line:732 for O0OOO0OOOO00O00O0 ,O0O000OOOOO00OOO0 in OO0O0OOOO0OO0OO0O .items ():#line:733 O0O00O0O0OOOO0OOO =O0O00O0O0OOOO0OOO +1 #line:734 if len (OO000OO00O0000000 .items ())==1 :#line:735 if O0O00O0O0OOOO0OOO ==1 :#line:736 print ("bien")#line:737 return render_template ('pdf_casa_comercial1.html',user_image6 =OO000OOO000O00O00,abrir=abrir, user_image7 =O0000000OO0000O00 ,titulos =OO000OO00O0000000 )#line:738 else :#line:739 return render_template ('pdf_casa_comercial.html',user_image6 =OO000OOO000O00O00,abrir=abrir, user_image7 =O0000000OO0000O00 ,titulos =OO000OO00O0000000 )#line:740 else :#line:741 return render_template ('pdf_casa_comercial.html',user_image6 =OO000OOO000O00O00,abrir=abrir, user_image7 =O0000000OO0000O00 ,titulos =OO000OO00O0000000 )#line:742 @app .route ("/videos_trauma",methods =['GET','POST'])#line:744 async def videos_trauma ():#line:745 O0O000O0OOO00OOO0 =request .args .get ('link2')#line:746 OO0OOO00O0O00000O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:747 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') OOO000O000OO000O0 =await boton_pdf_video (1 ,"field_video",O0O000O0OOO00OOO0 )#line:748 OOO00OO0OO000O0OO =0 #line:749 for OOO00O0OOOOO0OO0O ,O000O0000O0000O00 in OOO000O000OO000O0 .items ():#line:750 for OO0O0OOO0O00O00O0 ,OO000O0O0OO0O0OO0 in O000O0000O0000O00 .items ():#line:751 OOO00OO0OO000O0OO =OOO00OO0OO000O0OO +1 #line:752 if len (OOO000O000OO000O0 .items ())==1 :#line:753 if OOO00OO0OO000O0OO ==1 :#line:754 print ("bien")#line:755 return render_template ('videos1.html',user_image6=OOO0000OOO000OOO0, abrir=abrir, user_image7 =OO0OOO00O0O00000O ,titulos =OOO000O000OO000O0 )#line:756 else :#line:757 return render_template ('videos.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OO0OOO00O0O00000O ,titulos =OOO000O000OO000O0 )#line:758 else :#line:759 return render_template ('videos.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OO0OOO00O0O00000O ,titulos =OOO000O000OO000O0 )#line:760 @app .route ("/materiales_trauma",methods =['GET','POST'])#line:762 async def materiales_trauma ():#line:763 O0O0O00000OOOOOOO =request .args .get ('link2')#line:764 O000O0O000O0000O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:765 OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0O0O000OO0OO00O0 =await boton_materiales (1 ,O0O0O00000OOOOOOO )#line:766 if len (O0O0O000OO0OO00O0)==0 :#line:767 return render_template ('materiales.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =O000O0O000O0000O0 ,cajas =O0O0O000OO0OO00O0 ,no_hay ="No hay instrumental")#line:768 else :#line:769 if len (O0O0O000OO0OO00O0 )==1 :#line:770 return render_template ('materiales.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =O000O0O000O0000O0 ,cajas =O0O0O000OO0OO00O0 )#line:771 else :#line:772 return render_template ('materiales.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =O000O0O000O0000O0 ,cajas =O0O0O000OO0OO00O0 )#line:773 @app .route ("/escuchar_trauma1",methods =['GET','POST'])#line:775 async def escuchar_trauma1 ():#line:776 OOO0OOO00O000OO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:777 O00OO0O000O00O0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:778 O0OOOO0OO00OOO0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:779 OOO00OO0O0O000OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:780 O00OOOOO0000O0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:781 OOOO000OOOO00O0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:782 O00O0000O0O0O00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:783 O00OO0OOO0000OO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:784 return render_template ('escuchar_trauma1.html', nid2 =0 ,user_image5 =OOOO000OOOO00O0O0 ,user_image6 =O00O0000O0O0O00O0 ,user_image7 =O00OO0OOO0000OO00 ,user_image8 =O0OOOO0OO00OOO0OO ,user_image9 =OOO00OO0O0O000OOO ,user_image10 =OOO0OOO00O000OO00 ,user_image11 =O00OOOOO0000O0O00 ,user_image12 =O00OO0O000O00O0O0 )#line:785 @app .route ("/escuchar_trauma",methods =['GET','POST'])#line:787 async def escuchar_trauma ():#line:788 OOOO00OOO0OOO000O =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:791 OO00O0O0O00OOO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:792 O0OO000OOOOOO0O0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:793 O000O0O00000O0OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:794 OO0O0OOO0OOOO0OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:795 OO00OO0O0OO0OO000 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:796 O0OOOO0000O00O000 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:797 OOO000OOOO0000OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:798 OOO000000000000OO =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:799 OO0O0OOO0OOOO0OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:803 OO00OO0O0OO0OO000 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:804 O0OOOO0000O00O000 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:805 OOO000OOOO0000OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:806 OOO000000000000OO =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:807 OO00O0O0O00OOO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:808 O0OO000OOOOOO0O0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:809 O000O0O00000O0OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:810 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0O0OO0OO0O0OO0OO =sr .Recognizer ()#line:814 O000OOOO000OOOO00 =""#line:816 if request .method =="POST":#line:818 O0OOO0000OO0OOO00 =request .files ['audio_data']#line:819 with sr .AudioFile (O0OOO0000OO0OOO00 )as O00000OOO00OO0O0O :#line:821 OOO0OO00O0000O00O =O0O0OO0OO0O0OO0OO .record (O00000OOO00OO0O0O )#line:822 try :#line:825 O000OOOO000OOOO00 =O0O0OO0OO0O0OO0OO .recognize_google (OOO0OO00O0000O00O ,language ='es-ES')#line:826 except sr .UnknownValueError :#line:827 O000OOOO000OOOO00 ="No se pudo reconocer el audio"#line:828 except sr .RequestError as OO000O000OO0OO000 :#line:829 O000OOOO000OOOO00 =f"Error en la solicitud: {str(OO000O000OO0OO000)}"#line:830 print (O000OOOO000OOOO00 )#line:831 OOO00OOOOOO00O00O =O000OOOO000OOOO00 #line:837 print(OOO00OOOOOO00O00O) print ("TEXTO")#line:838 print (OOO00OOOOOO00O00O )#line:839 OOO00OOOOOO00O00O =str (OOO00OOOOOO00O00O ).lower ()#line:841 OOO00OOOOOO00O00O =OOO00OOOOOO00O00O .split ()#line:842 OOOO0OOOOO0OOOO00 ={}#line:843 OOOO0OOOOO0OOOO00 [""]=""#line:844 if OOO00OOOOOO00O00O [0 ]!="none":#line:845 O0O00OOO0OOO0OOO0 =1 #line:846 OO0OO0O0O0000O0O0 =await cargar_base_datos (OOO00OOOOOO00O00O ,O0O00OOO0OOO0OOO0 )#line:847 OOO0000OOOOO00000 ,OO0OOO00OOO0OOO00 ,OO00O00OO0OO00O00 =await buscar_faq (OOO00OOOOOO00O00O ,0 )#line:848 if OO0OO0O0O0000O0O0 ==None :#line:849 if len (OOO0000OOOOO00000 )==0 :#line:850 return render_template ('escuchar_trauma.html', nid2 =0 ,result_busqueda =OOOO0OOOOO0OOOO00 ,prediction_text ="No hay resultados para tu busqueda",user_image6 =O0OO000OOOOOO0O0O ,user_image7 =O000O0O00000O0OO0 ,user_image5 =OO00O0O0O00OOO0O0 ,user_image8 =O0OOOO0000O00O000 ,user_image9 =OOO000OOOO0000OO0 ,user_image10 =OO0O0OOO0OOOO0OOO ,user_image11 =OOO000000000000OO ,user_image12 =OO00OO0O0OO0OO000 )#line:851 else :#line:853 return render_template ('escuchar_trauma.html', nid2 =0 ,faqs =OOO0000OOOOO00000 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =OOOO0OOOOO0OOOO00 ,user_image6 =O0OO000OOOOOO0O0O ,user_image7 =O000O0O00000O0OO0 ,user_image5 =OO00O0O0O00OOO0O0 ,user_image8 =O0OOOO0000O00O000 ,user_image9 =OOO000OOOO0000OO0 ,user_image10 =OO0O0OOO0OOOO0OOO ,user_image11 =OOO000000000000OO ,user_image12 =OO00OO0O0OO0OO000 )#line:854 elif len (OO0OO0O0O0000O0O0 )>=1 :#line:856 OO00O0O000O000000 =[]#line:857 OOOO0OO0O00OO0000 =[]#line:858 OOOO0OOOOO0OOOO00 ={}#line:859 for O0O0000000OO0OO00 in OO0OO0O0O0000O0O0 :#line:860 OO00O0O000O000000 .append (O0O0000000OO0OO00 ["title"])#line:861 OOOO0OO0O00OO0000 .append (O0O0000000OO0OO00 ["nid"])#line:862 for OO0OO00O0O0OO0OO0 ,O0O0000000OO0OO00 in enumerate (OO00O0O000O000000 ):#line:863 OOOO0OOOOO0OOOO00 [OOOO0OO0O00OO0000 [OO0OO00O0O0OO0OO0 ]]=O0O0000000OO0OO00 #line:864 print ("RESULT BUSQUEDA")#line:865 print (OOOO0OOOOO0OOOO00 )#line:866 if len (OOO0000OOOOO00000 )==0 :#line:867 print ("render1")#line:868 return render_template ('escuchar_trauma.html',abrir=abrir, nid2 =0 ,result_busqueda =OOOO0OOOOO0OOOO00 ,user_image6 =O0OO000OOOOOO0O0O ,user_image7 =O000O0O00000O0OO0 ,user_image5 =OO00O0O0O00OOO0O0 ,user_image8 =O0OOOO0000O00O000 ,user_image9 =OOO000OOOO0000OO0 ,user_image10 =OO0O0OOO0OOOO0OOO ,user_image11 =OOO000000000000OO ,user_image12 =OO00OO0O0OO0OO000 )#line:869 else :#line:871 print ("render2")#line:872 return render_template ('escuchar_trauma.html',abrir=abrir, faqs =OOO0000OOOOO00000 ,faq_titulo ="Preguntas y respuestas: ", nid2 =0 ,result_busqueda =OOOO0OOOOO0OOOO00 ,user_image6 =O0OO000OOOOOO0O0O ,user_image7 =O000O0O00000O0OO0 ,user_image5 =OO00O0O0O00OOO0O0 ,user_image8 =O0OOOO0000O00O000 ,user_image9 =OOO000OOOO0000OO0 ,user_image10 =OO0O0OOO0OOOO0OOO ,user_image11 =OOO000000000000OO ,user_image12 =OO00OO0O0OO0OO000 )#line:869 #return render_template ('buscador_trauma.html',abrir=abrir, faqs =OOO0000OOOOO00000 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =OOOO0OOOOO0OOOO00 ,user_image4 =OOOO00OOO0OOO000O ,user_image5 =OO00O0O0O00OOO0O0 ,user_image6 =O0OO000OOOOOO0O0O ,user_image7 =O000O0O00000O0OO0 ,user_image8 =O0OOOO0000O00O000 ,user_image9 =OOO000OOOO0000OO0 ,user_image10 =OO0O0OOO0OOOO0OOO ,user_image11 =OOO000000000000OO ,user_image12 =OO00OO0O0OO0OO000 ,nid2 =0 )#line:873 else :#line:875 return render_template ('escuchar_trauma.html',nid2 =0 ,abrir=abrir, result_busqueda =OOOO0OOOOO0OOOO00 ,prediction_text ="No te he entendido bien, dale al boton `Escuchar´ y repite tu pregunta",user_image5 =OO00O0O0O00OOO0O0 ,user_image6 =O0OO000OOOOOO0O0O ,user_image7 =O000O0O00000O0OO0 ,user_image8 =O0OOOO0000O00O000 ,user_image9 =OOO000OOOO0000OO0 ,user_image10 =OO0O0OOO0OOOO0OOO ,user_image11 =OOO000000000000OO ,user_image12 =OO00OO0O0OO0OO000 )#line:876 @app .route ("/buscador_admision",methods =['GET','POST'])#line:878 async def buscador_admision ():#line:879 O0OO00OOO000OOOOO =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:880 O0OO000000O00O000 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:881 O00O00O0O0O0O0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:882 OO000O0000OO0O00O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:883 O000OO0O0O00O0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'otros_img.png')#line:884 OO0O0OO00000O00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'programacion_img.png')#line:885 OOO0000OO00OO0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'preguntas_respuestas.png')#line:886 OOO00OOOO0OOO00OO =os .path .join (app .config ['UPLOAD_FOLDER'],'ambulancias_img.jpg')#line:887 OOO0O00O00O0OO000 =os .path .join (app .config ['UPLOAD_FOLDER'],'mapa_camas_img.jpg')#line:888 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O00OOO00000000OOO =str (request .form .to_dict ())#line:889 O00OOO00000000OOO =adaptar_salida (O00OOO00000000OOO )#line:890 O0000O00O0O00O00O ={}#line:891 O0000O00O0O00O00O [""]=""#line:892 if len (O00OOO00000000OOO )==0 :#line:893 return render_template ('buscador_admision.html',abrir=abrir, preguntas_respuestas =OOO0000OO00OO0O00 ,user_image8 =OOO0O00O00O0OO000 ,user_image9 =OOO00OOOO0OOO00OO ,user_image10 =OO0O0OO00000O00O0 ,user_image11 =O000OO0O0O00O0O00 ,result_busqueda =O0000O00O0O00O00O ,user_image4 =O0OO00OOO000OOOOO ,user_image5 =O0OO000000O00O000 ,user_image6 =O00O00O0O0O0O0000 ,user_image7 =OO000O0000OO0O00O )#line:894 elif O00OOO00000000OOO !=None or "{}":#line:895 O000OO0OO00O0O00O =1621 #line:896 OO0O000O00O0O000O =await cargar_base_datos (O00OOO00000000OOO ,O000OO0OO00O0O00O )#line:897 O00O0OOOOOOO0OO0O ,O0OO000OOO0O00O0O ,O00000OO00OO00000 =await buscar_faq (O00OOO00000000OOO ,1 )#line:898 if OO0O000O00O0O000O ==None :#line:899 if len (O00000OO00OO00000 )==0 :#line:900 return render_template ('buscador_admision.html', preguntas_respuestas =OOO0000OO00OO0O00 ,user_image8 =OOO0O00O00O0OO000 ,user_image9 =OOO00OOOO0OOO00OO ,user_image10 =OO0O0OO00000O00O0 ,user_image11 =O000OO0O0O00O0O00 ,result_busqueda =O0000O00O0O00O00O ,prediction_text ="No hay resultados para tu busqueda",user_image4 =O0OO00OOO000OOOOO ,user_image5 =O0OO000000O00O000 ,user_image6 =O00O00O0O0O0O0000 ,user_image7 =OO000O0000OO0O00O )#line:901 else :#line:902 return render_template ('buscador_admision.html', preguntas_respuestas =OOO0000OO00OO0O00 ,user_image8 =OOO0O00O00O0OO000 ,user_image9 =OOO00OOOO0OOO00OO ,user_image10 =OO0O0OO00000O00O0 ,user_image11 =O000OO0O0O00O0O00 ,faqs =O00000OO00OO00000 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =O0000O00O0O00O00O ,user_image4 =O0OO00OOO000OOOOO ,user_image5 =O0OO000000O00O000 ,user_image6 =O00O00O0O0O0O0000 ,user_image7 =OO000O0000OO0O00O )#line:903 elif len (OO0O000O00O0O000O )>=1 :#line:904 O00OO00O0O0OO0OO0 =[]#line:905 O0OOO00O000O0OO0O =[]#line:906 O0000O00O0O00O00O ={}#line:907 for OO00O0OOOO00OO000 in OO0O000O00O0O000O :#line:908 O0OOO00O000O0OO0O .append (OO00O0OOOO00OO000 ["nid"])#line:909 for O0OOOO0OOO00OO0OO in O0OOO00O000O0OO0O :#line:910 O00000000O0OO00O0 =aiohttp .TCPConnector (ssl =True )#line:911 async with aiohttp .ClientSession (connector =O00000000O0OO00O0 )as OOO0000O00OOOOO0O :#line:912 OOOOO0O00O000O000 =await OOO0000O00OOOOO0O .get ('https://orva.tedcas.com/api/intervenciones/'+str (O0OOOO0OOO00OO0OO ),auth =auth )#line:913 OO0O00O0OOOOOO000 =await OOOOO0O00O000O000 .json ()#line:914 OO0O00O0OOOOOO000 =OO0O00O0OOOOOO000 [0 ]#line:915 OOO000000OO0O0O0O =OO0O00O0OOOOOO000 ['field_pdf']#line:916 OOO000000OO0O0O0O =OOO000000OO0O0O0O [0 ]#line:917 O0000O00O0O00O00O [OO0O00O0OOOOOO000 ['title']]="https://orva.tedcas.com/"+str (OOO000000OO0O0O0O ['url'])#line:918 if len (O00000OO00OO00000 )==0 :#line:919 return render_template ('buscador_admision1.html',abrir=abrir, user_image8 =OOO0O00O00O0OO000 ,user_image9 =OOO00OOOO0OOO00OO ,user_image10 =OO0O0OO00000O00O0 ,user_image11 =O000OO0O0O00O0O00 ,result_busqueda =O0000O00O0O00O00O ,user_image4 =O0OO00OOO000OOOOO ,user_image5 =O0OO000000O00O000 ,user_image6 =O00O00O0O0O0O0000 ,user_image7 =OO000O0000OO0O00O )#line:920 else :#line:921 return render_template ('buscador_admision1.html',abrir=abrir, faqs =O00000OO00OO00000 ,faq_titulo ="Preguntas y respuestas: ",user_image8 =OOO0O00O00O0OO000 ,user_image9 =OOO00OOOO0OOO00OO ,user_image10 =OO0O0OO00000O00O0 ,user_image11 =O000OO0O0O00O0O00 ,result_busqueda =O0000O00O0O00O00O ,user_image4 =O0OO00OOO000OOOOO ,user_image5 =O0OO000000O00O000 ,user_image6 =O00O00O0O0O0O0000 ,user_image7 =OO000O0000OO0O00O )#line:922 @app .route ("/mapa_camas",methods =['GET','POST'])#line:924 async def mapa_camas ():#line:925 OO0000O0O00O0000O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:926 O0OO0OOOO00OO0OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:927 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OO00O0O0OO0O00OO0 ,O0O0O0O00OOO0O00O ,O00O00OOO000O0OOO ,OOO00OOOO00O000O0 =await cargar_botones_pdf_admision ()#line:928 return render_template ('mapa_camas.html',abrir=abrir, text =OO00O0O0OO0O00OO0 ,user_image6 =OO0000O0O00O0000O ,user_image7 =O0OO0OOOO00OO0OOO )#line:929 @app .route ("/ambulancias",methods =['GET','POST'])#line:931 async def ambulancias ():#line:932 O0O0OOOO0O0O00OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:933 OOOO00OOOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:934 O0O0000OOOOOOO00O ,O00OOO00000O0O0O0 ,O0OO0OOO0OO000000 ,OO0OO0OO0OOO0OO0O =await cargar_botones_pdf_admision ()#line:935 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') return render_template ('ambulancias.html',abrir=abrir, text =O00OOO00000O0O0O0 ,user_image6 =O0O0OOOO0O0O00OO0 ,user_image7 =OOOO00OOOO000OOO0 )#line:936 @app .route ("/programacion_quirurgica",methods =['GET','POST'])#line:938 async def programacion_quirurgica ():#line:939 O0OOO0OO0OOO0OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:940 OO00000OOO0O0OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:941 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0000O0O000O0O000 ,O0000OOO000O0O0O0 ,O0OOO0OOO00OO00O0 ,OOOO0O00000O0O00O =await cargar_botones_pdf_admision ()#line:942 return render_template ('programacion_quirurgica.html',abrir=abrir, text =O0OOO0OOO00OO00O0 ,user_image6 =O0OOO0OO0OOO0OO0O ,user_image7 =OO00000OOO0O0OO0O )#line:943 @app .route ("/otros",methods =['GET','POST'])#line:945 async def otros ():#line:946 O000O0O0O00000000 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:947 O0000OO00O0O0O0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:948 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OO0O0OO0O0O0OOO00 ,O0O0OOOOO00O00OOO ,OOOOOO00OOO0OOO0O ,OOO0OO00OOOO0OO0O =await cargar_botones_pdf_admision ()#line:949 return render_template ('otros.html',abrir=abrir, text =OOO0OO00OOOO0OO0O ,user_image6 =O000O0O0O00000000 ,user_image7 =O0000OO00O0O0O0O0 )#line:950 @app .route ("/escuchar_admision1",methods =['GET','POST'])#line:952 async def escuchar_admision1 ():#line:953 O00O0OOO00OO0O0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'otros_img.png')#line:954 O00O00OO0OO0000O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'programacion_img.png')#line:955 OOOO000000O000OO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ambulancias_img.jpg')#line:956 O0O000OO00O00OO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'mapa_camas_img.jpg')#line:957 OOO000OOOO00O00OO =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:958 O000000OOO0OO0OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:959 O00OO0O00000OOO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:960 return render_template ('escuchar_admision1.html',user_image8 =O0O000OO00O00OO00 ,user_image9 =OOOO000000O000OO0 ,user_image10 =O00O00OO0OO0000O0 ,user_image11 =O00O0OOO00OO0O0OO ,prediction_text ="Dale a `Escuchar´ y haz tu pregunta",user_image5 =OOO000OOOO00O00OO ,user_image6 =O000000OOO0OO0OOO ,user_image7 =O00OO0O00000OOO0O )#line:961 @app .route ("/escuchar_admision",methods =['GET','POST'])#line:963 async def escuchar_admision ():#line:964 OOO0O000O000000OO =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:967 O00OOOOOOO0O0OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:968 OO0OOOO0OO000OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:969 OO0O000OO0O0OOO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:970 OO0O0OO00O000O00O =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:971 O0OO0O00000OO00OO =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:972 O0O0OOOO0O00O00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:973 OOOO0O0O000OOOO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:974 OO0O000O000O0OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:975 O0O00O0O00O0OOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'otros_img.png')#line:979 OO00O00O00O0OO00O =os .path .join (app .config ['UPLOAD_FOLDER'],'programacion_img.png')#line:980 O00O000OO00OO0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'ambulancias_img.jpg')#line:981 OO0OO00OO00OO0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'mapa_camas_img.jpg')#line:982 OOO0O000O000000OO =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:983 O00OOOOOOO0O0OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:984 OO0OOOO0OO000OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:985 OO0O000OO0O0OOO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:986 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0OO0OOOO0O0O0O0O =sr .Recognizer ()#line:988 O0O0O0000OO0O000O =""#line:990 if request .method =="POST":#line:992 OO0O000OO0000OO0O =request .files ['audio_data']#line:993 with sr .AudioFile (OO0O000OO0000OO0O )as O00OO0OOOO0OO0OO0 :#line:995 O0O0O0O000O00OO0O =O0OO0OOOO0O0O0O0O .record (O00OO0OOOO0OO0OO0 )#line:996 try :#line:999 O0O0O0000OO0O000O =O0OO0OOOO0O0O0O0O .recognize_google (O0O0O0O000O00OO0O ,language ='es-ES')#line:1000 except sr .UnknownValueError :#line:1001 O0O0O0000OO0O000O ="No se pudo reconocer el audio"#line:1002 except sr .RequestError as OOO0O0OO0OOO0OO00 :#line:1003 O0O0O0000OO0O000O =f"Error en la solicitud: {str(OOO0O0OO0OOO0OO00)}"#line:1004 print (O0O0O0000OO0O000O )#line:1005 O0OO00O0OO0OOO0O0 =O0O0O0000OO0O000O #line:1008 O0OO00O0OO0OOO0O0 =str (O0OO00O0OO0OOO0O0 ).lower ()#line:1013 O0OO00O0OO0OOO0O0 =O0OO00O0OO0OOO0O0 .split ()#line:1014 print (O0OO00O0OO0OOO0O0 )#line:1015 OO0O0O00O00OOOOO0 ={}#line:1016 OO0O0O00O00OOOOO0 [""]=""#line:1017 if O0OO00O0OO0OOO0O0 [0 ]!="none":#line:1018 OOO0000O000O000O0 =1621 #line:1019 OO0O0O0OOO000OOOO =await cargar_base_datos (O0OO00O0OO0OOO0O0 ,OOO0000O000O000O0 )#line:1020 OO0OOO00OO00O00O0 ,OOO0OOOOO0OO0O000 ,O0O00OO0O0OO00O00 =await buscar_faq (O0OO00O0OO0OOO0O0 ,1 )#line:1021 if OO0O0O0OOO000OOOO ==None :#line:1022 if len (O0O00OO0O0OO00O00 )==0 :#line:1023 return render_template ('escuchar_admision.html', user_image8 =OO0OO00OO00OO0000 ,user_image9 =O00O000OO00OO0O00 ,user_image10 =OO00O00O00O0OO00O ,user_image11 =O0O00O0O00O0OOOO0 ,result_busqueda =OO0O0O00O00OOOOO0 ,prediction_text ="No hay resultados para tu busqueda",user_image4 =OOO0O000O000000OO ,user_image5 =O00OOOOOOO0O0OO0O ,user_image6 =OO0OOOO0OO000OO0O ,user_image7 =OO0O000OO0O0OOO00 )#line:1024 else :#line:1025 return render_template ('escuchar_admision.html', faqs =O0O00OO0O0OO00O00 ,faq_titulo ="Preguntas y respuestas: ",user_image8 =OO0OO00OO00OO0000 ,user_image9 =O00O000OO00OO0O00 ,user_image10 =OO00O00O00O0OO00O ,user_image11 =O0O00O0O00O0OOOO0 ,result_busqueda =OO0O0O00O00OOOOO0 ,user_image4 =OOO0O000O000000OO ,user_image5 =O00OOOOOOO0O0OO0O ,user_image6 =OO0OOOO0OO000OO0O ,user_image7 =OO0O000OO0O0OOO00 )#line:1026 elif len (OO0O0O0OOO000OOOO )>=1 :#line:1027 O0O0O0OOOO0OO00O0 =[]#line:1028 OOO00OOO0O0000000 =[]#line:1029 OO0O0O00O00OOOOO0 ={}#line:1030 for OOO0OOOOO000OOO0O in OO0O0O0OOO000OOOO :#line:1031 OOO00OOO0O0000000 .append (OOO0OOOOO000OOO0O ["nid"])#line:1032 for O000000OOOO0O00OO in OOO00OOO0O0000000 :#line:1033 O0000O0O000OOO00O =aiohttp .TCPConnector (ssl =True )#line:1034 async with aiohttp .ClientSession (connector =O0000O0O000OOO00O )as OO000OOOOOO0OOOO0 :#line:1035 O0O0OOO000O00OOOO =await OO000OOOOOO0OOOO0 .get ('https://orva.tedcas.com/api/intervenciones/'+str (O000000OOOO0O00OO ),auth =auth )#line:1036 O0O00OO000OO0OOOO =await O0O0OOO000O00OOOO .json ()#line:1037 O0O00OO000OO0OOOO =O0O00OO000OO0OOOO [0 ]#line:1038 O0OOO000OOO0OOOO0 =O0O00OO000OO0OOOO ['field_pdf']#line:1039 O0OOO000OOO0OOOO0 =O0OOO000OOO0OOOO0 [0 ]#line:1040 OO0O0O00O00OOOOO0 [O0O00OO000OO0OOOO ['title']]="https://orva.tedcas.com/"+str (O0OOO000OOO0OOOO0 ['url'])#line:1041 if len (O0O00OO0O0OO00O00 )==0 :#line:1042 return render_template ('escuchar_admision.html',abrir=abrir, user_image8 =OO0OO00OO00OO0000 ,user_image9 =O00O000OO00OO0O00 ,user_image10 =OO00O00O00O0OO00O ,user_image11 =O0O00O0O00O0OOOO0 ,result_busqueda =OO0O0O00O00OOOOO0 ,user_image4 =OOO0O000O000000OO ,user_image5 =O00OOOOOOO0O0OO0O ,user_image6 =OO0OOOO0OO000OO0O ,user_image7 =OO0O000OO0O0OOO00 )#line:1043 else :#line:1044 print ("render2")#line:1045 return render_template ('escuchar_admision.html',abrir=abrir, faqs =O0O00OO0O0OO00O00 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =OO0O0O00O00OOOOO0 ,user_image8 =OO0OO00OO00OO0000 ,user_image9 =O00O000OO00OO0O00 ,user_image10 =OO00O00O00O0OO00O ,user_image11 =O0O00O0O00O0OOOO0 ,user_image4 =OOO0O000O000000OO ,user_image5 =O00OOOOOOO0O0OO0O ,user_image6 =OO0OOOO0OO000OO0O ,user_image7 =OO0O000OO0O0OOO00 )#line:1043 #return render_template ('buscador_admision.html',abrir=abrir, faqs =O0O00OO0O0OO00O00 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =OO0O0O00O00OOOOO0 ,user_image4 =OOO0O000O000000OO ,user_image5 =O00OOOOOOO0O0OO0O ,user_image6 =OO0OOOO0OO000OO0O ,user_image7 =OO0O000OO0O0OOO00 ,user_image8 =O0O0OOOO0O00O00O0 ,user_image9 =OOOO0O0O000OOOO0O ,user_image10 =OO0O0OO00O000O00O ,user_image11 =OO0O000O000O0OOO0 ,user_image12 =O0OO0O00000OO00OO ,nid2 =0 )#line:1046 else :#line:1048 return render_template ('escuchar_admision.html',abrir=abrir, user_image8 =OO0OO00OO00OO0000 ,user_image9 =O00O000OO00OO0O00 ,user_image10 =OO00O00O00O0OO00O ,user_image11 =O0O00O0O00O0OOOO0 ,prediction_text ="No te he entendido bien, dale al boton `Escuchar´ y repite tu pregunta",result_busqueda =OO0O0O00O00OOOOO0 ,user_image4 =OOO0O000O000000OO ,user_image5 =O00OOOOOOO0O0OO0O ,user_image6 =OO0OOOO0OO000OO0O ,user_image7 =OO0O000OO0O0OOO00 )#line:1049 @app .route ("/buscador_uro",methods =['GET','POST'])#line:1051 async def buscador_uro ():#line:1052 O00O0OO00OOOOOOOO =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:1053 O00O00O00O00OOO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:1054 OO0O00O00OOOO0O0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:1055 O0OO0OO0O0O00O0OO =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1056 OO0O000OO00OOOOOO =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:1057 O00O00OOOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:1058 O00O00O0000OO0000 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:1059 O0O00O00O000000O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:1060 O00O0OOOO0O00O0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'preguntas_respuestas.png')#line:1061 OO0OO0O0O0OO0OOOO =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:1062 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0O0000OO0OO0O000 =str (request .form .to_dict ())#line:1063 O0O0000OO0OO0O000 =adaptar_salida (O0O0000OO0OO0O000 )#line:1064 O0OOOO0000000O0O0 ={}#line:1065 O0OOOO0000000O0O0 [""]=""#line:1066 if len (O0O0000OO0OO0O000 )==0 :#line:1067 return render_template ('buscador_uro.html',abrir=abrir, preguntas_respuestas =O00O0OOOO0O00O0O0 ,result_busqueda =O0OOOO0000000O0O0 ,user_image4 =O00O0OO00OOOOOOOO ,user_image5 =O00O00O00O00OOO0O ,user_image6 =OO0O00O00OOOO0O0O ,user_image7 =O0OO0OO0O0O00O0OO ,user_image8 =O00O00O0000OO0000 ,user_image9 =O0O00O00O000000O0 ,user_image10 =OO0O000OO00OOOOOO ,user_image11 =OO0OO0O0O0OO0OOOO ,user_image12 =O00O00OOOO000OOO0 ,nid2 =0 )#line:1068 elif O0O0000OO0OO0O000 !=None or "{}":#line:1069 OO0000000OO0O00OO =1620 #line:1070 O00000000O00OO0O0 =await cargar_base_datos (O0O0000OO0OO0O000 ,OO0000000OO0O00OO )#line:1071 O0OO00OOOO00O0OOO ,OOO00OOOOOO0O0OOO ,O0O0O0OOO0000OOO0 =await buscar_faq (O0O0000OO0OO0O000 ,1 )#line:1072 if O00000000O00OO0O0 ==None :#line:1073 if len (OOO00OOOOOO0O0OOO )==0 :#line:1074 return render_template ('buscador_uro.html', preguntas_respuestas =O00O0OOOO0O00O0O0 ,result_busqueda =O0OOOO0000000O0O0 ,prediction_text ="No hay resultados para tu busqueda",user_image4 =O00O0OO00OOOOOOOO ,user_image5 =O00O00O00O00OOO0O ,user_image6 =OO0O00O00OOOO0O0O ,user_image7 =O0OO0OO0O0O00O0OO ,user_image8 =O00O00O0000OO0000 ,user_image9 =O0O00O00O000000O0 ,user_image10 =OO0O000OO00OOOOOO ,user_image11 =OO0OO0O0O0OO0OOOO ,user_image12 =O00O00OOOO000OOO0 ,nid2 =0 )#line:1075 else :#line:1076 return render_template ('buscador_uro.html', preguntas_respuestas =O00O0OOOO0O00O0O0 ,faqs =OOO00OOOOOO0O0OOO ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =O0OOOO0000000O0O0 ,user_image4 =O00O0OO00OOOOOOOO ,user_image5 =O00O00O00O00OOO0O ,user_image6 =OO0O00O00OOOO0O0O ,user_image7 =O0OO0OO0O0O00O0OO ,user_image8 =O00O00O0000OO0000 ,user_image9 =O0O00O00O000000O0 ,user_image10 =OO0O000OO00OOOOOO ,user_image11 =OO0OO0O0O0OO0OOOO ,user_image12 =O00O00OOOO000OOO0 ,nid2 =0 )#line:1077 elif len (O00000000O00OO0O0 )>=1 :#line:1078 OOO00OOOOOO00O0OO =[]#line:1079 OOO0OOOO00O0000OO =[]#line:1080 O0OOOO0000000O0O0 ={}#line:1081 for O0OO000O00OOOO00O in O00000000O00OO0O0 :#line:1082 OOO00OOOOOO00O0OO .append (O0OO000O00OOOO00O ["title"])#line:1083 OOO0OOOO00O0000OO .append (O0OO000O00OOOO00O ["nid"])#line:1084 for OOO000OO0O000O000 ,O0OO000O00OOOO00O in enumerate (OOO00OOOOOO00O0OO ):#line:1085 O0OOOO0000000O0O0 [OOO0OOOO00O0000OO [OOO000OO0O000O000 ]]=O0OO000O00OOOO00O #line:1086 if len (OOO00OOOOOO0O0OOO )!=0 :#line:1087 return render_template ('buscador_uro1.html',abrir=abrir, faqs =OOO00OOOOOO0O0OOO ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =O0OOOO0000000O0O0 ,user_image4 =O00O0OO00OOOOOOOO ,user_image5 =O00O00O00O00OOO0O ,user_image6 =OO0O00O00OOOO0O0O ,user_image7 =O0OO0OO0O0O00O0OO ,user_image8 =O00O00O0000OO0000 ,user_image9 =O0O00O00O000000O0 ,user_image10 =OO0O000OO00OOOOOO ,user_image11 =OO0OO0O0O0OO0OOOO ,user_image12 =O00O00OOOO000OOO0 ,nid2 =0 )#line:1088 else :#line:1089 if len(O0OOOO0000000O0O0)==1: return redirect(url_for('resultado_uro',link=OOO0OOOO00O0000OO)) else: return render_template ('buscador_uro1.html',abrir=abrir, result_busqueda =O0OOOO0000000O0O0 ,user_image4 =O00O0OO00OOOOOOOO ,user_image5 =O00O00O00O00OOO0O ,user_image6 =OO0O00O00OOOO0O0O ,user_image7 =O0OO0OO0O0O00O0OO ,user_image8 =O00O00O0000OO0000 ,user_image9 =O0O00O00O000000O0 ,user_image10 =OO0O000OO00OOOOOO ,user_image11 =OO0OO0O0O0OO0OOOO ,user_image12 =O00O00OOOO000OOO0 ,nid2 =0 )#line:1090 @app .route ("/resultado_uro",methods =['GET','POST'])#line:1092 async def resultado_uro ():#line:1093 OO0O0OOO00OO00OOO =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:1094 OOOOOOOO0O0OO0O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1095 OOO0O0O00O0O0000O =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:1096 O0O0OO0OO0OO0O00O =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:1097 OOOOO0O000OOO00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:1098 OO00O0OOOOOO0OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:1099 OOO0OOO00000000OO =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:1100 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OOO00O00O0O0O00OO =request .args .get ('link')#line:1101 OO000OOOOOO0OOO00 ,O0O000OO00O000OOO =await cargar_tipo (OOO00O00O0O0O00OO ,1620 )#line:1102 O00OOO0OO00O00OOO =OO000OOOOOO0OOO00 ['title']#line:1103 if O0O000OO00O000OOO =="Intervencion":#line:1104 print ("hola1")#line:1105 OO000O00000O00O0O ,O0OO000O0O00OO000 =await cargar_caja (str (OOO00O00O0O0O00OO ),'Instrumental - Cajas: ')#line:1106 return render_template ('intervencion_uro.html',abrir=abrir, user_image8 =OOOOO0O000OOO00O0 ,user_image9 =OO00O0OOOOOO0OO0O ,user_image10 =OOO0O0O00O0O0000O ,user_image11 =OOO0OOO00000000OO ,user_image12 =O0O0OO0OO0OO0O00O ,instrumental =OO000O00000O00O0O ,texto_cajas =O0OO000O0O00OO000 ,title =O00OOO0OO00O00OOO ,user_image6 =OO0O0OOO00OO00OOO ,user_image7 =OOOOOOOO0O0OO0O00 ,nid2 =OOO00O00O0O0O00OO )#line:1107 elif O0O000OO00O000OOO =='Caja':#line:1108 OO0OO00OO0O00OOOO ,O0OOO0OOOO0OOO0OO ,O0O00000O00O00000 =await cargar_archivo ("ubicacion","Ubicacion: ","cajas/"+str (OOO00O00O0O0O00OO ))#line:1109 O000OO00OOO0O0O00 =await cargar_archivo ("image","Imagen: ","cajas/"+str (OOO00O00O0O0O00OO ))#line:1110 OOO000O0O0OOO0OO0 ,OO0OOOOO0OO00000O =await cargar_archivo_grande ("title_material","Instrumental : ","cajas/"+str (OOO00O00O0O0O00OO ))#line:1111 return render_template ('caja_trauma.html',abrir=abrir, title =O00OOO0OO00O00OOO ,files_instru =OOO000O0O0OOO0OO0 ,texto_instru =OO0OOOOO0OO00000O ,texto_ubi =OO0OO00OO0O00OOOO ,file_texto_ubi =O0O00000O00O00000 ,file_imagen =O000OO00OOO0O0O00 ,user_image6 =OO0O0OOO00OO00OOO ,user_image7 =OOOOOOOO0O0OO0O00 )#line:1115 elif O0O000OO00O000OOO =='Instrumental':#line:1116 print ("hola2")#line:1117 OO00O00OOO0O000O0 =await cargar_instrumental (OOO00O00O0O0O00OO ,'listado_completo_cajas/1620')#line:1118 return render_template ('instrumental_uro.html',abrir=abrir, cajas =OO00O00OOO0O000O0 ,texto ='El instrumental que buscas esta presente en las siguientes cajas: ',title =O00OOO0OO00O00OOO ,user_image6 =OO0O0OOO00OO00OOO ,user_image7 =OOOOOOOO0O0OO0O00 )#line:1122 @app .route ("/protocolos_uro",methods =['GET','POST'])#line:1124 async def protocolos_uro ():#line:1125 OOOO0OOO0OO0OOO00 =request .args .get ('link2')#line:1126 O0O00OOOO0OO0O00O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1127 OO000OOO000O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OO0OO0O0O00O00O00 =await boton_word_ppt (1620 ,"field_protocolo",OOOO0OOO0OO0OOO00 )#line:1128 if len (OO0OO0O0O00O00O00 )==1 :#line:1129 return render_template ('protocolo1.html',user_image6 =OO000OOO000O00O00,abrir=abrir, protocolos =OO0OO0O0O00O00O00 ,user_image7 =O0O00OOOO0OO0O00O )#line:1130 else :#line:1131 return render_template ('protocolo.html',user_image6 =OO000OOO000O00O00,abrir=abrir, protocolos =OO0OO0O0O00O00O00 ,user_image7 =O0O00OOOO0OO0O00O )#line:1132 @app .route ("/guia_visual_uro",methods =['GET','POST'])#line:1134 async def guia_visual_uro ():#line:1135 OOO0OOOOOO00O0O0O =request .args .get ('link2')#line:1136 OO0OOO0O0OO00O00O =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1137 OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') OO00O00O00OOO0OOO =await boton_word_ppt (1620 ,"field_guia_visual",OOO0OOOOOO00O0O0O )#line:1138 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') if len (OO00O00O00OOO0OOO )==1 :#line:1139 return render_template ('guia_visual1.html',abrir=abrir,user_image6 =OOO0000OOO000OOO0, guia_visual =OO00O00O00OOO0OOO ,user_image7 =OO0OOO0O0OO00O00O )#line:1140 else :#line:1141 return render_template ('guia_visual.html',abrir=abrir,user_image6 =OOO0000OOO000OOO0,guia_visual =OO00O00O00OOO0OOO ,user_image7 =OO0OOO0O0OO00O00O )#line:1142 @app .route ("/pdf_casa_uro",methods =['GET','POST'])#line:1144 async def pdf_casa_uro ():#line:1145 OO0O000OOOO00OOO0 =request .args .get ('link2')#line:1146 O00OOOO0OO00OO000 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1147 OO000OOO000O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') OOO00O0000O00O000 =await boton_pdf_video (1620 ,"field_pdf",OO0O000OOOO00OOO0 )#line:1148 O00OOOO0O00O00O0O =0 #line:1149 for O0OO00OO0OO00O00O ,OOO000OO0OOO0OO0O in OOO00O0000O00O000 .items ():#line:1150 for O00OO0OOO0O0OO00O ,O0O000OOO000O0OOO in OOO000OO0OOO0OO0O .items ():#line:1151 O00OOOO0O00O00O0O =O00OOOO0O00O00O0O +1 #line:1152 if len (OOO00O0000O00O000 .items ())==1 :#line:1153 if O00OOOO0O00O00O0O ==1 :#line:1154 print ("bien")#line:1155 return render_template ('pdf_casa_comercial1.html',user_image6 =OO000OOO000O00O00,abrir=abrir, user_image7 =O00OOOO0OO00OO000 ,titulos =OOO00O0000O00O000 )#line:1156 else :#line:1157 return render_template ('pdf_casa_comercial.html',user_image6 =OO000OOO000O00O00,abrir=abrir, user_image7 =O00OOOO0OO00OO000 ,titulos =OOO00O0000O00O000 )#line:1158 else :#line:1159 return render_template ('pdf_casa_comercial.html',user_image6 =OO000OOO000O00O00,abrir=abrir, user_image7 =O00OOOO0OO00OO000 ,titulos =OOO00O0000O00O000 )#line:1160 @app .route ("/videos_uro",methods =['GET','POST'])#line:1162 async def videos_uro ():#line:1163 OO0000OO000O00000 =request .args .get ('link2')#line:1164 OOOOO00000O0OO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1165 OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0O0OO0000OO0OOO0 =await boton_pdf_video (1620 ,"field_video",OO0000OO000O00000 )#line:1166 OOOOOO0O0O0OO0O0O =0 #line:1167 for O00O00O0OOOOOOOO0 ,OOO0000O0000O0000 in O0O0OO0000OO0OOO0 .items ():#line:1168 for OOO0000O000O00O00 ,O0O0OOO0OO0OO0OOO in OOO0000O0000O0000 .items ():#line:1169 OOOOOO0O0O0OO0O0O =OOOOOO0O0O0OO0O0O +1 #line:1170 if len (O0O0OO0000OO0OOO0 .items ())==1 :#line:1171 if OOOOOO0O0O0OO0O0O ==1 :#line:1172 return render_template ('videos1.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OOOOO00000O0OO0O0 ,titulos =O0O0OO0000OO0OOO0 )#line:1173 else :#line:1174 return render_template ('videos.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OOOOO00000O0OO0O0 ,titulos =O0O0OO0000OO0OOO0 )#line:1175 else :#line:1176 return render_template ('videos.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OOOOO00000O0OO0O0 ,titulos =O0O0OO0000OO0OOO0 )#line:1177 @app .route ("/materiales_uro",methods =['GET','POST'])#line:1179 async def materiales_uro ():#line:1180 O00OO0OO0OOO0OOO0 =request .args .get ('link2')#line:1181 OOO00O00O00OO00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1182 OOO0000OOO000OOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png') abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O0O00O00O000O000O =await boton_materiales (1620 ,O00OO0OO0OOO0OOO0 )#line:1183 if len (O0O00O00O000O000O [''])==0 :#line:1184 return render_template ('materiales_uro.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OOO00O00O00OO00O0 ,cajas =O0O00O00O000O000O ,no_hay ="No hay instrumental")#line:1185 else :#line:1186 if len (O0O00O00O000O000O )==1 :#line:1187 return render_template ('materiales_uro1.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OOO00O00O00OO00O0 ,cajas =O0O00O00O000O000O )#line:1188 else :#line:1189 return render_template ('materiales_uro.html',user_image6=OOO0000OOO000OOO0,abrir=abrir, user_image7 =OOO00O00O00OO00O0 ,cajas =O0O00O00O000O000O )#line:1190 @app .route ("/escuchar_uro1",methods =['GET','POST'])#line:1192 async def escuchar_uro1 ():#line:1193 O0000O00O00O0000O =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:1194 OOOOOO00OO0OOOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:1195 OO0O00OO00O0OO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:1196 O0O00OO00OOOOOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:1197 O0OOOO00OO00OOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:1198 OO000OO000OOOOO00 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:1199 OO0OOOOOO0O0OOO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:1200 O0OO0O00O0OO0OOOO =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1201 return render_template ('escuchar_uro1.html',nid2 =0 ,user_image5 =OO000OO000OOOOO00 ,user_image6 =OO0OOOOOO0O0OOO0O ,user_image7 =O0OO0O00O0OO0OOOO ,user_image8 =OO0O00OO00O0OO0O0 ,user_image9 =O0O00OO00OOOOOOO0 ,user_image10 =O0000O00O00O0000O ,user_image11 =O0OOOO00OO00OOOO0 ,user_image12 =OOOOOO00OO0OOOOO0 )#line:1202 @app .route ("/escuchar_uro",methods =['GET','POST'])#line:1204 async def escuchar_uro ():#line:1205 O00000OOOO0O00O0O =os .path .join (app .config ['UPLOAD_FOLDER'],'lupa.png')#line:1208 OOO0O00O00OOOOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:1209 O00OO0OOO00OOO00O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:1210 O00OO00OOO0O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1211 O00000O0O00OOO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:1212 OO00O0O00000OOO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:1213 O0000000O0O000O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:1214 O000OO0O00OO0000O =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:1215 OOOOO00OO0O00OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:1216 O00000O0O00OOO0O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'guia_visual.png')#line:1218 OO00O0O00000OOO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'materiales.png')#line:1219 O0000000O0O000O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'pdf_casa.jpg')#line:1220 O000OO0O00OO0000O =os .path .join (app .config ['UPLOAD_FOLDER'],'protocolo.jpg')#line:1221 OOOOO00OO0O00OO0O =os .path .join (app .config ['UPLOAD_FOLDER'],'visualizar_video.png')#line:1222 OOO0O00O00OOOOOO0 =os .path .join (app .config ['UPLOAD_FOLDER'],'micro.png')#line:1223 O00OO0OOO00OOO00O =os .path .join (app .config ['UPLOAD_FOLDER'],'ajustes.png')#line:1224 O00OO00OOO0O00O00 =os .path .join (app .config ['UPLOAD_FOLDER'],'flecha.png')#line:1225 abrir = os .path .join (app .config ['UPLOAD_FOLDER'],'abrir.png') O00O0O000000OOO0O =sr .Recognizer ()#line:1227 OOOOO000000O00O00 =""#line:1229 if request .method =="POST":#line:1231 OO00OOOOOO0OO00OO =request .files ['audio_data']#line:1232 with sr .AudioFile (OO00OOOOOO0OO00OO )as OO0OOO00OO0OOOO00 :#line:1234 OO00O00O0OO0OOOOO =O00O0O000000OOO0O .record (OO0OOO00OO0OOOO00 )#line:1235 try :#line:1238 OOOOO000000O00O00 =O00O0O000000OOO0O .recognize_google (OO00O00O0OO0OOOOO ,language ='es-ES')#line:1239 except sr .UnknownValueError :#line:1240 OOOOO000000O00O00 ="No se pudo reconocer el audio"#line:1241 except sr .RequestError as OOOO0O0O0OO0O0O00 :#line:1242 OOOOO000000O00O00 =f"Error en la solicitud: {str(OOOO0O0O0OO0O0O00)}"#line:1243 print (OOOOO000000O00O00 )#line:1244 O000OO00OOO0O0OO0 =OOOOO000000O00O00 #line:1247 O000OO00OOO0O0OO0 =str (O000OO00OOO0O0OO0 ).lower ()#line:1251 O000OO00OOO0O0OO0 =O000OO00OOO0O0OO0 .split ()#line:1252 O0OOOO00O000O0OO0 ={}#line:1253 O0OOOO00O000O0OO0 [""]=""#line:1254 if O000OO00OOO0O0OO0 [0 ]!="none":#line:1255 OO00OOOOO000O0O0O =1620 #line:1256 O0OO0OO0000OO0OOO =await cargar_base_datos (O000OO00OOO0O0OO0 ,OO00OOOOO000O0O0O )#line:1257 O0OOO000O00000000 ,OOOOO000O00OOOOO0 ,O0O00OO00OO000O00 =await buscar_faq (O000OO00OOO0O0OO0 ,0 )#line:1258 if O0OO0OO0000OO0OOO ==None :#line:1259 if len (OOOOO000O00OOOOO0 )==0 :#line:1260 return render_template ('escuchar_uro.html', nid2 =0 ,result_busqueda =O0OOOO00O000O0OO0 ,prediction_text ="No hay resultados para tu busqueda",user_image6 =O00OO0OOO00OOO00O ,user_image7 =O00OO00OOO0O00O00 ,user_image5 =OOO0O00O00OOOOOO0 ,user_image8 =O0000000O0O000O00 ,user_image9 =O000OO0O00OO0000O ,user_image10 =O00000O0O00OOO0O0 ,user_image11 =OOOOO00OO0O00OO0O ,user_image12 =OO00O0O00000OOO0O )#line:1261 else :#line:1262 return render_template ('escuchar_uro.html', nid2 =0 ,faqs =OOOOO000O00OOOOO0 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =O0OOOO00O000O0OO0 ,user_image6 =O00OO0OOO00OOO00O ,user_image7 =O00OO00OOO0O00O00 ,user_image5 =OOO0O00O00OOOOOO0 ,user_image8 =O0000000O0O000O00 ,user_image9 =O000OO0O00OO0000O ,user_image10 =O00000O0O00OOO0O0 ,user_image11 =OOOOO00OO0O00OO0O ,user_image12 =OO00O0O00000OOO0O )#line:1263 elif len (O0OO0OO0000OO0OOO )>=1 :#line:1264 O0O00OO0OO00O0OOO =[]#line:1265 O0000OOOO00O0OOO0 =[]#line:1266 O0OOOO00O000O0OO0 ={}#line:1267 for OO0000OOO000OOOO0 in O0OO0OO0000OO0OOO :#line:1268 O0O00OO0OO00O0OOO .append (OO0000OOO000OOOO0 ["title"])#line:1269 O0000OOOO00O0OOO0 .append (OO0000OOO000OOOO0 ["nid"])#line:1270 for O0OO00000000O00OO ,OO0000OOO000OOOO0 in enumerate (O0O00OO0OO00O0OOO ):#line:1271 O0OOOO00O000O0OO0 [O0000OOOO00O0OOO0 [O0OO00000000O00OO ]]=OO0000OOO000OOOO0 #line:1272 if len (OOOOO000O00OOOOO0 )==0 :#line:1274 return render_template ('escuchar_uro.html',abrir=abrir, nid2 =0 ,result_busqueda =O0OOOO00O000O0OO0 ,user_image6 =O00OO0OOO00OOO00O ,user_image7 =O00OO00OOO0O00O00 ,user_image5 =OOO0O00O00OOOOOO0 ,user_image8 =O0000000O0O000O00 ,user_image9 =O000OO0O00OO0000O ,user_image10 =O00000O0O00OOO0O0 ,user_image11 =OOOOO00OO0O00OO0O ,user_image12 =OO00O0O00000OOO0O )#line:1275 else :#line:1276 return render_template ('escuchar_uro.html',abrir=abrir, faqs =OOOOO000O00OOOOO0 ,faq_titulo ="Preguntas y respuestas: ",result_busqueda =O0OOOO00O000O0OO0 ,user_image4 =O00000OOOO0O00O0O ,user_image5 =OOO0O00O00OOOOOO0 ,user_image6 =O00OO0OOO00OOO00O ,user_image7 =O00OO00OOO0O00O00 ,user_image8 =O0000000O0O000O00 ,user_image9 =O000OO0O00OO0000O ,user_image10 =O00000O0O00OOO0O0 ,user_image11 =OOOOO00OO0O00OO0O ,user_image12 =OO00O0O00000OOO0O ,nid2 =0 )#line:1278 else :#line:1280 return render_template ('escuchar_uro.html',nid2 =0 ,abrir=abrir, result_busqueda =O0OOOO00O000O0OO0 ,prediction_text ="No te he entendido bien, dale al boton `Escuchar´ y repite tu pregunta",user_image5 =OOO0O00O00OOOOOO0 ,user_image6 =O00OO0OOO00OOO00O ,user_image7 =O00OO00OOO0O00O00 ,user_image8 =O0000000O0O000O00 ,user_image9 =O000OO0O00OO0000O ,user_image10 =O00000O0O00OOO0O0 ,user_image11 =OOOOO00OO0O00OO0O ,user_image12 =OO00O0O00000OOO0O )#line:1281 @app .route ("/ajustes")#line:1283 async def ajustes ():#line:1284 OO00OOOOOO0OO00O0 =os .path .join (app .config ['UPLOAD_FOLDER'],'estrella.png')#line:1285 return render_template ('ajustes.html',user_image7 =OO00OOOOOO0OO00O0 )#line:1286 if __name__ =="__main__":#line:1288 app .run (host ="0.0.0.0",port =7860 ,debug =True )#line:1289