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()