Spaces:
Runtime error
Runtime error
Capsule Ready 💊
Browse files- .gitignore +1 -0
- app.py +7 -2
- encrypter.py +20 -0
- requirements.txt +2 -2
.gitignore
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
/venv/
|
|
|
|
| 2 |
|
| 3 |
source.jpg
|
| 4 |
source.png
|
|
|
|
| 1 |
/venv/
|
| 2 |
+
/nycklar/
|
| 3 |
|
| 4 |
source.jpg
|
| 5 |
source.png
|
app.py
CHANGED
|
@@ -2,10 +2,12 @@ import gradio as gr
|
|
| 2 |
import sulkuPypi
|
| 3 |
from funciones import mass
|
| 4 |
from data import usuarios
|
|
|
|
|
|
|
| 5 |
|
| 6 |
#Funciones adicionales
|
| 7 |
def authenticate(username, password):
|
| 8 |
-
|
| 9 |
for u, p in usuarios:
|
| 10 |
if username == u and password == p:
|
| 11 |
gr.State.usuario = username
|
|
@@ -16,9 +18,12 @@ def authenticate(username, password):
|
|
| 16 |
def perform(input1, input2):
|
| 17 |
|
| 18 |
print("Primero que nada, el usuarrio es: ", gr.State.usuario)
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
#Primero que nada, checa cuantos tokens:
|
| 21 |
-
tokens = sulkuPypi.getTokens(
|
| 22 |
print(f"Tienes: {tokens} tokens. ")
|
| 23 |
|
| 24 |
#Después autoriza.
|
|
|
|
| 2 |
import sulkuPypi
|
| 3 |
from funciones import mass
|
| 4 |
from data import usuarios
|
| 5 |
+
import encrypter
|
| 6 |
+
import time
|
| 7 |
|
| 8 |
#Funciones adicionales
|
| 9 |
def authenticate(username, password):
|
| 10 |
+
|
| 11 |
for u, p in usuarios:
|
| 12 |
if username == u and password == p:
|
| 13 |
gr.State.usuario = username
|
|
|
|
| 18 |
def perform(input1, input2):
|
| 19 |
|
| 20 |
print("Primero que nada, el usuarrio es: ", gr.State.usuario)
|
| 21 |
+
capsule = encrypter.encripta(gr.State.usuario)
|
| 22 |
+
print("Y éste es el usuario encriptado: ", capsule )
|
| 23 |
+
time.sleep(5)
|
| 24 |
|
| 25 |
#Primero que nada, checa cuantos tokens:
|
| 26 |
+
tokens = sulkuPypi.getTokens(capsule)
|
| 27 |
print(f"Tienes: {tokens} tokens. ")
|
| 28 |
|
| 29 |
#Después autoriza.
|
encrypter.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import nycklar.nodes as nodes
|
| 2 |
+
from cryptography.fernet import Fernet
|
| 3 |
+
|
| 4 |
+
def encripta(username):
|
| 5 |
+
|
| 6 |
+
key = nodes.key
|
| 7 |
+
fernet = Fernet(key)
|
| 8 |
+
|
| 9 |
+
string_original = username
|
| 10 |
+
string_encriptado = fernet.encrypt(string_original.encode("utf-8"))
|
| 11 |
+
string_desencriptado = fernet.decrypt(string_encriptado).decode("utf-8")
|
| 12 |
+
|
| 13 |
+
print("String original:", string_original)
|
| 14 |
+
print("String encriptado:", string_encriptado)
|
| 15 |
+
print("String desencriptado:", string_desencriptado)
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
|
| 19 |
+
print(encripta('briggsboardman'))
|
| 20 |
+
#pass
|
requirements.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
#numpy==1.24.3
|
| 2 |
numpy
|
| 3 |
opencv-python
|
| 4 |
customtkinter==5.2.0
|
|
@@ -13,4 +12,5 @@ gfpgan
|
|
| 13 |
tensorflow==2.13.0
|
| 14 |
protobuf==4.23.4
|
| 15 |
tqdm==4.65.0
|
| 16 |
-
onnxruntime-gpu
|
|
|
|
|
|
|
|
|
| 1 |
numpy
|
| 2 |
opencv-python
|
| 3 |
customtkinter==5.2.0
|
|
|
|
| 12 |
tensorflow==2.13.0
|
| 13 |
protobuf==4.23.4
|
| 14 |
tqdm==4.65.0
|
| 15 |
+
onnxruntime-gpu
|
| 16 |
+
python-cryptography-fernet-wrapper
|