File size: 803 Bytes
68ca8cd
8aacc0a
68ca8cd
8aacc0a
 
68ca8cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from transformers import T5ForConditionalGeneration, T5Tokenizer

model = T5ForConditionalGeneration.from_pretrained("t5-base")
tokenizer = T5Tokenizer.from_pretrained("t5-base")

def evaluate_password_strength(password):
    input_text = f"Rate the strength of the password: {password}"
    inputs = tokenizer(input_text, return_tensors="pt")
    output = model.generate(**inputs)
    response = tokenizer.decode(output[0], skip_special_tokens=True)
    return response

demo = gr.Interface(
    evaluate_password_strength,
    gr.Textbox(label="Enter your password"),
    gr.Textbox(label="Password Strength Evaluation"),
    title="Password Strength Evaluator",
    description="Get the AI's evaluation of your password strength.",
)

if __name__ == "__main__":
    demo.launch()