Spaces:
Build error
Build error
Envs
Browse files- .gitignore +3 -0
- app.py +4 -5
- envCharger.py +27 -0
- funciones.py +7 -0
- testloadenv.py +0 -12
.gitignore
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
/venv/
|
| 2 |
.env
|
|
|
|
|
|
|
|
|
|
| 3 |
source.jpg
|
| 4 |
source.png
|
| 5 |
target.jpg
|
|
|
|
| 1 |
/venv/
|
| 2 |
.env
|
| 3 |
+
.env.dev
|
| 4 |
+
.env.local
|
| 5 |
+
.env.prod
|
| 6 |
source.jpg
|
| 7 |
source.png
|
| 8 |
target.jpg
|
app.py
CHANGED
|
@@ -114,11 +114,11 @@ destination_image = gr.Image(label="Destination")
|
|
| 114 |
#Outputs
|
| 115 |
result_image = gr.Image(label="Blend Result")
|
| 116 |
txt_credits = gr.Textbox(label="Credits Available", value="205", interactive=False)
|
|
|
|
| 117 |
lbl_console = gr.Label(label="AI Terminal Messages", value="AI Engine ready...", container=True)
|
| 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()
|
|
@@ -135,11 +135,10 @@ with gr.Blocks(theme=gr.themes.Base(), css="footer {visibility: hidden}") as mai
|
|
| 135 |
gr.Markdown(visible=True)
|
| 136 |
gr.Markdown(visible=True)
|
| 137 |
gr.Markdown(visible=True)
|
| 138 |
-
lbl_credits = gr.Label(label="Credits Available", value=valor, scale=1)
|
|
|
|
| 139 |
result_image.change(fn=display_tokens, outputs=lbl_credits)
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
with gr.Row():
|
| 144 |
|
| 145 |
demo = gr.Interface(
|
|
|
|
| 114 |
#Outputs
|
| 115 |
result_image = gr.Image(label="Blend Result")
|
| 116 |
txt_credits = gr.Textbox(label="Credits Available", value="205", interactive=False)
|
| 117 |
+
html_credits = gr.HTML("<div>Credits = 205</div>")
|
| 118 |
lbl_console = gr.Label(label="AI Terminal Messages", value="AI Engine ready...", container=True)
|
| 119 |
btn_buy = gr.Button("Buy More", visible=True, size='lg')
|
| 120 |
#btn_buy.click(fn=click_buy, outputs=mrk_title)
|
| 121 |
|
|
|
|
| 122 |
#Gradio themes:
|
| 123 |
# — gr.themes.Base()
|
| 124 |
# — gr.themes.Default()
|
|
|
|
| 135 |
gr.Markdown(visible=True)
|
| 136 |
gr.Markdown(visible=True)
|
| 137 |
gr.Markdown(visible=True)
|
| 138 |
+
#lbl_credits = gr.Label(label="Credits Available", value=valor, scale=1)
|
| 139 |
+
lbl_credits = gr.Textbox(label="Credits Available", value="205", interactive=False)
|
| 140 |
result_image.change(fn=display_tokens, outputs=lbl_credits)
|
| 141 |
+
|
|
|
|
|
|
|
| 142 |
with gr.Row():
|
| 143 |
|
| 144 |
demo = gr.Interface(
|
envCharger.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
|
| 4 |
+
# Carga las variables del archivo .env
|
| 5 |
+
|
| 6 |
+
def load_env(environment):
|
| 7 |
+
"""Carga el archivo .env correspondiente al ambiente especificado."""
|
| 8 |
+
|
| 9 |
+
dotenv_path = f".env.{environment}"
|
| 10 |
+
print("Esto es dotenv_path")
|
| 11 |
+
load_dotenv(dotenv_path)
|
| 12 |
+
|
| 13 |
+
if __name__ == "__main__":
|
| 14 |
+
|
| 15 |
+
#Carga el cambiente local o prod
|
| 16 |
+
load_env("local")
|
| 17 |
+
|
| 18 |
+
# Accede a las variables como si fueran variables de entorno normales
|
| 19 |
+
MODO = os.getenv('modo')
|
| 20 |
+
PLATAFORMA = os.getenv('plataforma')
|
| 21 |
+
PROCESADOR = os.getenv('procesador')
|
| 22 |
+
COMPUTING = os.getenv('computing')
|
| 23 |
+
|
| 24 |
+
print(MODO)
|
| 25 |
+
print(PLATAFORMA)
|
| 26 |
+
print(PROCESADOR)
|
| 27 |
+
print(COMPUTING)
|
funciones.py
CHANGED
|
@@ -2,8 +2,15 @@ import os
|
|
| 2 |
import time
|
| 3 |
import pathlib
|
| 4 |
from PIL import Image
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def mass(input1, input2):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
#video o cualquier otro sería para imagenes.
|
| 9 |
modo = "pic"
|
|
|
|
| 2 |
import time
|
| 3 |
import pathlib
|
| 4 |
from PIL import Image
|
| 5 |
+
import envCharger
|
| 6 |
+
|
| 7 |
|
| 8 |
def mass(input1, input2):
|
| 9 |
+
|
| 10 |
+
envCharger.load_env("local")
|
| 11 |
+
PLATAFORMA = os.getenv('plataforma')
|
| 12 |
+
print("PLATAFORMA: ", PLATAFORMA)
|
| 13 |
+
time.sleep(5)
|
| 14 |
|
| 15 |
#video o cualquier otro sería para imagenes.
|
| 16 |
modo = "pic"
|
testloadenv.py
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from dotenv import load_dotenv
|
| 3 |
-
|
| 4 |
-
# Carga las variables del archivo .env
|
| 5 |
-
load_dotenv()
|
| 6 |
-
|
| 7 |
-
# Accede a las variables como si fueran variables de entorno normales
|
| 8 |
-
API_KEY = os.getenv('MI_VARIABLE')
|
| 9 |
-
DATABASE_URL = os.getenv('OTRA_VARIABLE')
|
| 10 |
-
|
| 11 |
-
print(API_KEY)
|
| 12 |
-
print(DATABASE_URL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|