Spaces:
Build error
Build error
Credits display ready!!!
Browse files
app.py
CHANGED
|
@@ -26,6 +26,8 @@ def authenticate(username, password):
|
|
| 26 |
gr.State.tokens = sulkuPypi.getTokens(capsule)
|
| 27 |
|
| 28 |
print(f"Tienes: {gr.State.tokens} tokens. ")
|
|
|
|
|
|
|
| 29 |
|
| 30 |
return True
|
| 31 |
#Si no hubo coincidencia regresas un false.
|
|
@@ -98,9 +100,11 @@ def click_buy():
|
|
| 98 |
|
| 99 |
def display_tokens():
|
| 100 |
|
| 101 |
-
print("Ejecutando display_tokens
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
#LOCAL VARIABLES
|
| 106 |
# gr.State.usuario = "briggsboardman"
|
|
@@ -115,13 +119,10 @@ destination_image = gr.Image(label="Destination")
|
|
| 115 |
|
| 116 |
#Outputs
|
| 117 |
print("En éste momento estoy creando los outputs...")
|
| 118 |
-
creditos =
|
| 119 |
result_image = gr.Image(label="Blend Result")
|
| 120 |
txt_credits = gr.Textbox(label="Credits Available", value="", interactive=False)
|
| 121 |
-
html_credits = gr.HTML(
|
| 122 |
-
<div style="text-align: right;">💶<b>Credits Available:</b>{creditos}</div>
|
| 123 |
-
""")
|
| 124 |
-
|
| 125 |
lbl_console = gr.Label(label="AI Terminal Messages", value="AI Engine ready...", container=True)
|
| 126 |
btn_buy = gr.Button("Buy More", visible=False, size='lg')
|
| 127 |
#btn_buy.click(fn=click_buy, outputs=mrk_title)
|
|
@@ -136,7 +137,10 @@ btn_buy = gr.Button("Buy More", visible=False, size='lg')
|
|
| 136 |
#valor = gr.State.tokens
|
| 137 |
valor = ""
|
| 138 |
|
| 139 |
-
with gr.Blocks(theme=gr.themes.Base(), css="footer {visibility: hidden}") as main:
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
with gr.Row():
|
| 142 |
|
|
|
|
| 26 |
gr.State.tokens = sulkuPypi.getTokens(capsule)
|
| 27 |
|
| 28 |
print(f"Tienes: {gr.State.tokens} tokens. ")
|
| 29 |
+
creditos = gr.State.tokens
|
| 30 |
+
print(f"Ésta es la cantidad guardada en creditos: {creditos}")
|
| 31 |
|
| 32 |
return True
|
| 33 |
#Si no hubo coincidencia regresas un false.
|
|
|
|
| 100 |
|
| 101 |
def display_tokens():
|
| 102 |
|
| 103 |
+
print("Ejecutando display_tokens, tienes: ", gr.State.tokens)
|
| 104 |
|
| 105 |
+
display = tools.actualizar_creditos(gr.State.tokens)
|
| 106 |
+
|
| 107 |
+
return display
|
| 108 |
|
| 109 |
#LOCAL VARIABLES
|
| 110 |
# gr.State.usuario = "briggsboardman"
|
|
|
|
| 119 |
|
| 120 |
#Outputs
|
| 121 |
print("En éste momento estoy creando los outputs...")
|
| 122 |
+
creditos = None
|
| 123 |
result_image = gr.Image(label="Blend Result")
|
| 124 |
txt_credits = gr.Textbox(label="Credits Available", value="", interactive=False)
|
| 125 |
+
html_credits = gr.HTML()
|
|
|
|
|
|
|
|
|
|
| 126 |
lbl_console = gr.Label(label="AI Terminal Messages", value="AI Engine ready...", container=True)
|
| 127 |
btn_buy = gr.Button("Buy More", visible=False, size='lg')
|
| 128 |
#btn_buy.click(fn=click_buy, outputs=mrk_title)
|
|
|
|
| 137 |
#valor = gr.State.tokens
|
| 138 |
valor = ""
|
| 139 |
|
| 140 |
+
with gr.Blocks(theme=gr.themes.Base(), css="footer {visibility: hidden}") as main:
|
| 141 |
+
|
| 142 |
+
#Función, input, output
|
| 143 |
+
main.load(display_tokens, None, html_credits )
|
| 144 |
|
| 145 |
with gr.Row():
|
| 146 |
|
tools.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
def actualizar_creditos(nuevos_creditos):
|
| 3 |
|
| 4 |
html_credits = f"""
|
| 5 |
-
<div style="text-align: right;">💶<b>Credits Available
|
| 6 |
"""
|
| 7 |
|
| 8 |
return html_credits
|
|
|
|
| 2 |
def actualizar_creditos(nuevos_creditos):
|
| 3 |
|
| 4 |
html_credits = f"""
|
| 5 |
+
<div style="text-align: right;">💶<b>Credits Available: </b> {nuevos_creditos}</div>
|
| 6 |
"""
|
| 7 |
|
| 8 |
return html_credits
|