Reqs
This commit is contained in:
parent
387cb18bab
commit
b5f235f5ae
163
apis.py
163
apis.py
|
@ -155,7 +155,89 @@ def EvalVoice(response:Response):
|
|||
db.commit()
|
||||
return Sal
|
||||
|
||||
@app.get("/evalvoicehtml")
|
||||
def EvalVoicehtml():
|
||||
dir_list = os.listdir(pathAud)
|
||||
Sal=""
|
||||
t=1
|
||||
for i in dir_list:
|
||||
|
||||
temp="""<option value="%s">Opción %s, %s</option>
|
||||
"""%(str(pwd+"/"+pathAud+"/"+i),str(t),str(i))
|
||||
Sal=Sal+temp
|
||||
t=t+1
|
||||
|
||||
|
||||
html="""<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Evaluacion de modelos voice2txt</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
input, button {
|
||||
margin: 10px 0;
|
||||
padding: 5px;
|
||||
}
|
||||
#respuesta {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Petición POST a API</h1>
|
||||
|
||||
<select id="texto1">
|
||||
%s
|
||||
</select>
|
||||
|
||||
<br>
|
||||
<select id="texto2">
|
||||
<option value="whisper">whisper</option>
|
||||
<option value="vosk">vosk</option>
|
||||
</select>
|
||||
<br>
|
||||
<button onclick="enviarPeticion()">Enviar petición</button>
|
||||
<div id="respuesta"></div>
|
||||
|
||||
<script>
|
||||
function enviarPeticion() {
|
||||
const texto1 = document.getElementById('texto1').value;
|
||||
const texto2 = document.getElementById('texto2').value;
|
||||
const datos = {
|
||||
path: texto1,
|
||||
model: texto2
|
||||
};
|
||||
|
||||
fetch('/EvalVoice', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(datos)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('respuesta').innerHTML = JSON.stringify(data, null, 2);
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('respuesta').innerHTML = 'Error: ' + error;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
"""%(Sal)
|
||||
return HTMLResponse(content=html, status_code=200)
|
||||
|
||||
#Por revisar
|
||||
|
||||
def list2tablehtml(listdata,model):
|
||||
html="""<h2>Table of {0}</h2>
|
||||
|
@ -345,87 +427,6 @@ def EvalLLMFact(response:Response2):
|
|||
Sal=main.EvalllmFacturas(path,task_prompt,system,content,max_tokens,model,prompt,TrustedLLmjson)
|
||||
return Sal
|
||||
|
||||
@app.get("/evalvoicehtml")
|
||||
def EvalVoicehtml():
|
||||
dir_list = os.listdir(pathAud)
|
||||
Sal=""
|
||||
t=1
|
||||
for i in dir_list:
|
||||
|
||||
temp="""<option value="%s">Opción %s, %s</option>
|
||||
"""%(str(pwd+"/"+pathAud+"/"+i),str(t),str(i))
|
||||
Sal=Sal+temp
|
||||
t=t+1
|
||||
|
||||
|
||||
html="""<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Evaluacion de modelos voice2txt</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
input, button {
|
||||
margin: 10px 0;
|
||||
padding: 5px;
|
||||
}
|
||||
#respuesta {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Petición POST a API</h1>
|
||||
|
||||
<select id="texto1">
|
||||
%s
|
||||
</select>
|
||||
|
||||
<br>
|
||||
<select id="texto2">
|
||||
<option value="whisper">whisper</option>
|
||||
<option value="vosk">vosk</option>
|
||||
</select>
|
||||
<br>
|
||||
<button onclick="enviarPeticion()">Enviar petición</button>
|
||||
<div id="respuesta"></div>
|
||||
|
||||
<script>
|
||||
function enviarPeticion() {
|
||||
const texto1 = document.getElementById('texto1').value;
|
||||
const texto2 = document.getElementById('texto2').value;
|
||||
const datos = {
|
||||
path: texto1,
|
||||
model: texto2
|
||||
};
|
||||
|
||||
fetch('/EvalVoice', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(datos)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('respuesta').innerHTML = JSON.stringify(data, null, 2);
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('respuesta').innerHTML = 'Error: ' + error;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
"""%(Sal)
|
||||
return HTMLResponse(content=html, status_code=200)
|
||||
|
||||
|
||||
@app.get("/evalocrfactura")
|
||||
|
|
126
gui.py
126
gui.py
|
@ -13,7 +13,13 @@ HTML = os.path.join(pwd,"html", "index.html")
|
|||
file_read = codecs.open(HTML, "r", "utf-8")
|
||||
index = file_read.read()
|
||||
html_page_index = Html(index)
|
||||
|
||||
def extractConfig(nameModel="SystemData",relPath=os.path.join(pwd,"conf/experiment_config.json"),dataOut="keyantrophics"):
|
||||
configPath=os.path.join(os.getcwd(),relPath)
|
||||
with open(configPath, 'r', encoding='utf-8') as file:
|
||||
config = json.load(file)[nameModel]
|
||||
Output= config[dataOut]
|
||||
return Output
|
||||
mode_list=extractConfig(nameModel="SystemData",dataOut="mode_list")
|
||||
def getmetricvoice(model):
|
||||
rows = db(db.analitic_voice.model==model).select()
|
||||
rows_list = rows.as_list()
|
||||
|
@ -48,93 +54,39 @@ def html_getmetricvoice():
|
|||
return html,data,datafiles
|
||||
html_page_getmetricsvoice,data_voice,data_files_voices=html_getmetricvoice()
|
||||
|
||||
|
||||
def evalVoicehtml():
|
||||
pathAud="example/audio"
|
||||
dir_list = os.listdir(pathAud)
|
||||
Sal=""
|
||||
t=1
|
||||
for i in dir_list:
|
||||
|
||||
temp="""<option value="%s">Opción %s, %s</option>
|
||||
"""%(str(pwd+"/"+pathAud+"/"+i),str(t),str(i))
|
||||
Sal=Sal+temp
|
||||
t=t+1
|
||||
|
||||
|
||||
html="""<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Evaluacion de modelos voice2txt</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
input, button {
|
||||
margin: 10px 0;
|
||||
padding: 5px;
|
||||
}
|
||||
#respuesta {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Petición POST a API</h1>
|
||||
|
||||
<select id="texto1">
|
||||
%s
|
||||
</select>
|
||||
|
||||
<br>
|
||||
<select id="texto2">
|
||||
<option value="whisper">whisper</option>
|
||||
<option value="vosk">vosk</option>
|
||||
</select>
|
||||
<br>
|
||||
<button onclick="enviarPeticion()">Enviar petición</button>
|
||||
<div id="respuesta"></div>
|
||||
|
||||
<script>
|
||||
function enviarPeticion() {
|
||||
const texto1 = document.getElementById('texto1').value;
|
||||
const texto2 = document.getElementById('texto2').value;
|
||||
const datos = {
|
||||
path: texto1,
|
||||
model: texto2
|
||||
};
|
||||
|
||||
fetch('/EvalVoice', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(datos)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('respuesta').innerHTML = JSON.stringify(data, null, 2);
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('respuesta').innerHTML = 'Error: ' + error;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
"""%(Sal)
|
||||
return html
|
||||
|
||||
|
||||
mode="voice"
|
||||
modetypedata="audio"
|
||||
file="id2"
|
||||
def changemenu(mode):
|
||||
if mode_list[mode]=="audio":
|
||||
pathori="example/audio"
|
||||
if mode_list[mode]=="factura":
|
||||
pathori="example/factura"
|
||||
if mode_list[mode]=="texto":
|
||||
pathori="example/texto"
|
||||
seltypedata=mode_list[mode]
|
||||
dir_list = os.listdir(pathori)
|
||||
|
||||
html_page_evalvoice = Html(evalVoicehtml())
|
||||
return pathori,seltypedata,dir_list
|
||||
|
||||
|
||||
def trustedallhtml(mode):
|
||||
pathori,seltypedata,dir_list=changemenu(mode)
|
||||
|
||||
|
||||
textmode=""
|
||||
for modeused in mode_list.keys():
|
||||
textmode=textmode+"('%s','%s'),"%(modeused,modeused)
|
||||
html="""<taipy:selector lov="{[%s]}" dropdown True on_change=changemenu>{sel}</taipy:selector>"""%(textmode)
|
||||
Sal=""
|
||||
for i in dir_list:
|
||||
temp="""('%s', '%s'),"""%(str(pwd+"/"+pathori+"/"+i),str(i))
|
||||
Sal=Sal+temp
|
||||
html2="""<taipy:selector lov="{[%s]}" dropdown True >{sel2}</taipy:selector>"""%(Sal)
|
||||
return html+html2
|
||||
|
||||
html_page_trustedall = Html(trustedallhtml(mode))
|
||||
#print(sel,sel2,seltypedata)
|
||||
HTML = os.path.join(pwd,"html", "index.html")
|
||||
file_read = codecs.open(HTML, "r", "utf-8")
|
||||
index = file_read.read()
|
||||
|
@ -145,7 +97,7 @@ data=pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
|
|||
pages = {
|
||||
"/": html_page_index ,
|
||||
"getmetricsvoice": Html(html_page_getmetricsvoice),
|
||||
"evalvoice":html_page_evalvoice
|
||||
"trustedall":html_page_trustedall
|
||||
}
|
||||
|
||||
app = Gui(pages=pages)
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
aiohttp==3.9.5
|
||||
aiosignal==1.3.1
|
||||
aniso8601==9.0.1
|
||||
annotated-types==0.7.0
|
||||
anyio==4.4.0
|
||||
apispec==6.4.0
|
||||
apispec-webframeworks==1.0.0
|
||||
arrow==1.3.0
|
||||
attrs==23.2.0
|
||||
audioread==3.0.1
|
||||
Automat==22.10.0
|
||||
bidict==0.23.1
|
||||
binaryornot==0.4.4
|
||||
blinker==1.8.2
|
||||
boto3==1.34.34
|
||||
botocore==1.34.150
|
||||
certifi==2024.2.2
|
||||
chardet==5.2.0
|
||||
charset-normalizer==3.3.2
|
||||
click==8.1.7
|
||||
constantly==23.10.4
|
||||
cookiecutter==2.5.0
|
||||
datasets==2.19.1
|
||||
deepdiff==6.7.1
|
||||
dill==0.3.8
|
||||
dnspython==2.6.1
|
||||
email_validator==2.2.0
|
||||
et-xmlfile==1.1.0
|
||||
evaluate==0.4.2
|
||||
fastapi==0.111.0
|
||||
fastapi-cli==0.0.4
|
||||
filelock==3.14.0
|
||||
Flask==3.0.2
|
||||
Flask-Cors==4.0.0
|
||||
Flask-RESTful==0.3.10
|
||||
Flask-SocketIO==5.3.6
|
||||
frozenlist==1.4.1
|
||||
fsspec==2024.3.1
|
||||
fuzzywuzzy==0.18.0
|
||||
gevent==23.9.1
|
||||
gevent-websocket==0.10.1
|
||||
gitignore_parser==0.1.11
|
||||
greenlet==3.0.3
|
||||
h11==0.14.0
|
||||
httpcore==1.0.5
|
||||
httptools==0.6.1
|
||||
httpx==0.27.0
|
||||
huggingface-hub==0.23.2
|
||||
hyperlink==21.0.0
|
||||
idna==3.7
|
||||
incremental==24.7.2
|
||||
itsdangerous==2.2.0
|
||||
Jinja2==3.1.4
|
||||
jmespath==1.0.1
|
||||
kthread==0.2.3
|
||||
Levenshtein==0.25.1
|
||||
Markdown==3.5.2
|
||||
markdown-it-py==3.0.0
|
||||
MarkupSafe==2.1.5
|
||||
marshmallow==3.20.2
|
||||
mdurl==0.1.2
|
||||
multidict==6.0.5
|
||||
multiprocess==0.70.16
|
||||
mutagen==1.47.0
|
||||
networkx==3.2.1
|
||||
numpy==1.26.4
|
||||
openpyxl==3.1.2
|
||||
ordered-set==4.1.0
|
||||
orjson==3.10.6
|
||||
packaging==24.0
|
||||
pandas==2.2.0
|
||||
passlib==1.7.4
|
||||
pyarrow==15.0.0
|
||||
pyarrow-hotfix==0.6
|
||||
pydal==20240713.1
|
||||
pydantic==2.8.2
|
||||
pydantic_core==2.20.1
|
||||
Pygments==2.18.0
|
||||
pymongo==4.6.1
|
||||
python-dateutil==2.9.0.post0
|
||||
python-dotenv==1.0.1
|
||||
python-engineio==4.9.1
|
||||
python-Levenshtein==0.25.1
|
||||
python-multipart==0.0.9
|
||||
python-slugify==8.0.4
|
||||
python-socketio==5.11.3
|
||||
pytz==2023.3.post1
|
||||
PyYAML==6.0.1
|
||||
rapidfuzz==3.9.4
|
||||
requests==2.32.3
|
||||
rich==13.7.1
|
||||
s3transfer==0.10.2
|
||||
shellingham==1.5.4
|
||||
simple-websocket==1.0.0
|
||||
six==1.16.0
|
||||
sniffio==1.3.1
|
||||
SQLAlchemy==2.0.25
|
||||
starlette==0.37.2
|
||||
taipy==3.1.1
|
||||
taipy-config==3.1.1
|
||||
taipy-core==3.1.1
|
||||
taipy-gui==3.1.4
|
||||
taipy-rest==3.1.1
|
||||
taipy-templates==3.1.1
|
||||
text-unidecode==1.3
|
||||
toml==0.10.2
|
||||
tqdm==4.66.4
|
||||
Twisted==23.10.0
|
||||
typer==0.12.3
|
||||
types-python-dateutil==2.9.0.20240316
|
||||
typing_extensions==4.12.0
|
||||
tzdata==2024.1
|
||||
tzlocal==5.2
|
||||
ujson==5.10.0
|
||||
urllib3==2.2.1
|
||||
uvicorn==0.30.1
|
||||
uvloop==0.19.0
|
||||
watchfiles==0.22.0
|
||||
websockets==12.0
|
||||
Werkzeug==3.0.3
|
||||
wsproto==1.2.0
|
||||
xxhash==3.4.1
|
||||
yarl==1.9.4
|
||||
zope.event==5.0
|
||||
zope.interface==6.4.post2
|
Loading…
Reference in New Issue