Moibe
Interface to Blocks
6b2b610
raw
history blame
849 Bytes
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():
print("Hola mundo")
return "Hola Mundo"
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
text_input = gr.Textbox()
enviar_btn = gr.Button(value="Submit")
with gr.Column():
text_output = gr.Textbox()
enviar_btn.click(fn=getAccess, inputs="text", outputs="text", api_name="entrar")
demo.launch()