Spaces:
Build error
Build error
Display tokens at load
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ def perform(input1, input2):
|
|
| 53 |
else:
|
| 54 |
info_window = "Out of credits..."
|
| 55 |
path = 'no-result.png'
|
| 56 |
-
return path, info_window, btn_buy
|
| 57 |
|
| 58 |
print(f"El path final fue {path}, si es no-result, no debites y controla la info window.")
|
| 59 |
print(f"El type de path es: ", type(path))
|
|
@@ -81,7 +81,7 @@ def perform(input1, input2):
|
|
| 81 |
#No se hizo un proceso, por lo tanto no debitaremos.
|
| 82 |
#En el futuro, como regla de negocio, podría cambiar y que si debitemos.
|
| 83 |
|
| 84 |
-
return path, info_window, btn_buy
|
| 85 |
|
| 86 |
def click_buy():
|
| 87 |
|
|
@@ -93,6 +93,12 @@ def click_buy():
|
|
| 93 |
|
| 94 |
return nuevo_markdown
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
#LOCAL VARIABLES
|
| 97 |
# gr.State.usuario = "briggsboardman"
|
| 98 |
# Capsule es el usuario encriptado que enviarás a la API de Sulku.
|
|
@@ -112,6 +118,7 @@ lbl_console = gr.Label(label="AI Terminal Messages", value="AI Engine ready...",
|
|
| 112 |
btn_buy = gr.Button("Buy More", visible=True, size='lg')
|
| 113 |
#btn_buy.click(fn=click_buy, outputs=mrk_title)
|
| 114 |
|
|
|
|
| 115 |
#Gradio themes:
|
| 116 |
# — gr.themes.Base()
|
| 117 |
# — gr.themes.Default()
|
|
@@ -127,6 +134,8 @@ with gr.Blocks(theme=gr.themes.Base(), css="footer {visibility: hidden}") as mai
|
|
| 127 |
with gr.Row():
|
| 128 |
gr.Label(visible=True, scale=5)
|
| 129 |
lbl_credits = gr.Label(label="Credits Available", value=valor, scale=1)
|
|
|
|
|
|
|
| 130 |
|
| 131 |
|
| 132 |
with gr.Row():
|
|
@@ -135,7 +144,7 @@ with gr.Blocks(theme=gr.themes.Base(), css="footer {visibility: hidden}") as mai
|
|
| 135 |
fn=perform,
|
| 136 |
title="",
|
| 137 |
inputs=[source_image, destination_image],
|
| 138 |
-
outputs=[result_image, lbl_console, btn_buy
|
| 139 |
)
|
| 140 |
|
| 141 |
main.launch(auth=authenticate)
|
|
|
|
| 53 |
else:
|
| 54 |
info_window = "Out of credits..."
|
| 55 |
path = 'no-result.png'
|
| 56 |
+
return path, info_window, btn_buy
|
| 57 |
|
| 58 |
print(f"El path final fue {path}, si es no-result, no debites y controla la info window.")
|
| 59 |
print(f"El type de path es: ", type(path))
|
|
|
|
| 81 |
#No se hizo un proceso, por lo tanto no debitaremos.
|
| 82 |
#En el futuro, como regla de negocio, podría cambiar y que si debitemos.
|
| 83 |
|
| 84 |
+
return path, info_window, btn_buy
|
| 85 |
|
| 86 |
def click_buy():
|
| 87 |
|
|
|
|
| 93 |
|
| 94 |
return nuevo_markdown
|
| 95 |
|
| 96 |
+
def display_tokens():
|
| 97 |
+
|
| 98 |
+
print("Ejecutando display_tokens...")
|
| 99 |
+
|
| 100 |
+
return gr.State.tokens
|
| 101 |
+
|
| 102 |
#LOCAL VARIABLES
|
| 103 |
# gr.State.usuario = "briggsboardman"
|
| 104 |
# Capsule es el usuario encriptado que enviarás a la API de Sulku.
|
|
|
|
| 118 |
btn_buy = gr.Button("Buy More", visible=True, size='lg')
|
| 119 |
#btn_buy.click(fn=click_buy, outputs=mrk_title)
|
| 120 |
|
| 121 |
+
|
| 122 |
#Gradio themes:
|
| 123 |
# — gr.themes.Base()
|
| 124 |
# — gr.themes.Default()
|
|
|
|
| 134 |
with gr.Row():
|
| 135 |
gr.Label(visible=True, scale=5)
|
| 136 |
lbl_credits = gr.Label(label="Credits Available", value=valor, scale=1)
|
| 137 |
+
lbl_console.change(fn=display_tokens, outputs=lbl_credits)
|
| 138 |
+
|
| 139 |
|
| 140 |
|
| 141 |
with gr.Row():
|
|
|
|
| 144 |
fn=perform,
|
| 145 |
title="",
|
| 146 |
inputs=[source_image, destination_image],
|
| 147 |
+
outputs=[result_image, lbl_console, btn_buy],
|
| 148 |
)
|
| 149 |
|
| 150 |
main.launch(auth=authenticate)
|