|
import herramientas |
|
import documentos |
|
import time |
|
from gradio_client import Client, handle_file |
|
|
|
async def procesa_dni(image): |
|
|
|
temp_image = await herramientas.imageToTemp(image) |
|
|
|
client = Client("Moibe/api_rapicash") |
|
dict_recibido = client.predict( |
|
img=handle_file(temp_image), |
|
lang="en", |
|
api_name="/predict" |
|
) |
|
|
|
|
|
textos_extraidos = herramientas.listaTextosExtraidos(dict_recibido) |
|
|
|
|
|
nombre, apellido, identificacion = documentos.dni(textos_extraidos) |
|
|
|
print(f"Hola: {nombre}, {apellido} con identificación: {identificacion}") |
|
|
|
return { |
|
"nombre": nombre, |
|
"apellido": apellido, |
|
"identificacion": identificacion |
|
} |
|
|