Spaces:
Runtime error
Runtime error
GarimaPuri01
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
letters=['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
|
5 |
+
Numbers=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
6 |
+
symbols=['&', '#', '(', ')', '-', '_', '^', '@', '+', '*', '§', '%', '!', '?']
|
7 |
+
|
8 |
+
def password(N_letters, N_numbers, N_symbols):
|
9 |
+
password_list=[]
|
10 |
+
for char in range(N_letters):
|
11 |
+
password_list+=random.choice(letters)
|
12 |
+
for char in range(N_numbers):
|
13 |
+
password_list+=random.choice(Numbers)
|
14 |
+
for char in range(N_symbols):
|
15 |
+
password_list+=random.choice(symbols)
|
16 |
+
random.shuffle(password_list)
|
17 |
+
psw=''
|
18 |
+
for char in password_list:
|
19 |
+
psw+=char
|
20 |
+
return "Your Password is : " +psw
|
21 |
+
demo=gr.Interface(fn=password, inputs=[gr.Slider(), gr.Slider(), gr.Slider()], outputs="text", Button= gr.Button("Generate"))
|
22 |
+
demo.launch()
|