File size: 1,003 Bytes
75c509f 629fd46 75c509f bc14969 cfb5a4a 75c509f bc14969 75c509f bc14969 2c3d53a 80e2b08 867e2cf 1746e25 91783aa 867e2cf bc14969 1746e25 867e2cf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import time
import avaimet
import gradio as gr
def getAccess(userfile):
sshListo, sftpListo = avaimet.conecta()
#Obtiene la caja donde está guardados los tokens.
caja = avaimet.obtenCaja(userfile)
tokens = avaimet.obtenTokens(sftpListo, caja)
resultado_final = avaimet.aplicaReglas(sftpListo, caja, tokens)
avaimet.cierraConexion(sshListo, sftpListo)
return resultado_final
def print(sulkukey):
print("Hola mundo")
return "Hola Mundo"
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
text_input = gr.Textbox()
access_btn = gr.Button(value="Submit")
debit_btn = gr.Button(value="Debit")
with gr.Column():
text_output = gr.Textbox()
access_btn.click(fn=getAccess, inputs=text_input, outputs=text_output, api_name="entrar")
debit_btn.click(fn=print, inputs=text_input, outputs=text_output, api_name="print")
demo.launch() |