File size: 937 Bytes
68ca8cd
316fef8
 
68ca8cd
316fef8
 
 
 
68ca8cd
 
316fef8
 
 
 
 
 
 
 
 
 
 
 
 
 
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
25
26
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr
from huggingface_hub import InferenceClient
import os

client = InferenceClient(
	provider="sambanova",
	api_key= os.getenv("superSecretKey")
)

def evaluate_password_strength(password):
    messages = [
        {
            "role": "user",
            "content": f"Rate the strength of the password: {password} as either 'Weak', 'Medium', or 'Strong'"
        }
    ]

    completion = client.chat.completions.create(
        model="meta-llama/Llama-3.1-8B-Instruct", 
        messages=messages, 
        max_tokens=500
    )

    response = completion.choices[0].message["content"]
    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()