File size: 1,574 Bytes
8767cd7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import gradio as gr

def generate_secure_password(full_name, private_word):
    name = full_name.strip().lower()
    secret = private_word.strip().lower()
    
    if not name or not secret:
        return "خطأ: يرجى إدخال الاسم والكلمة الخاصة!"

    first_two = name[:2]
    last_char = name[-1]
    
    combined = first_two + last_char + secret
    
 
    capitalized_part = combined.capitalize()
    
    
    final_password = f"{capitalized_part}_{len(combined)}"
    
    return final_password

# إنشاء واجهة Gradio
with gr.Blocks(title="مُولد كلمات السر الذكي") as demo:
    gr.Markdown("# 🛡️ نظام توليد كلمات السر الخاص بك")
    gr.Markdown("أدخل بياناتك للحصول على كلمة سر فريدة بناءً على خوارزميتك الخاصة.")
    
    with gr.Row():
        name_input = gr.Textbox(label="الاسم الكامل ")
        secret_input = gr.Textbox(label="كلمتك السرية الخاصة", placeholder="كلمة لا يعرفها غيرك", type="password")
    
    output_text = gr.Textbox(label="كلمة السر الناتجة", interactive=False)
    
    submit_btn = gr.Button("توليد كلمة السر", variant="primary")
    
    # ربط الوظيفة بالزر
    submit_btn.click(
        fn=generate_secure_password,
        inputs=[name_input, secret_input],
        outputs=output_text
    )

# تشغيل التطبيق
if __name__ == "__main__":
    demo.launch()