Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,27 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
|
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
def evaluate_password_strength(password):
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
return response
|
13 |
|
14 |
demo = gr.Interface(
|
|
|
1 |
import gradio as gr
|
2 |
+
from huggingface_hub import InferenceClient
|
3 |
+
import os
|
4 |
|
5 |
+
client = InferenceClient(
|
6 |
+
provider="sambanova",
|
7 |
+
api_key= os.getenv("superSecretKey")
|
8 |
+
)
|
9 |
|
10 |
def evaluate_password_strength(password):
|
11 |
+
messages = [
|
12 |
+
{
|
13 |
+
"role": "user",
|
14 |
+
"content": f"Rate the strength of the password: {password} as either 'Weak', 'Medium', or 'Strong'"
|
15 |
+
}
|
16 |
+
]
|
17 |
+
|
18 |
+
completion = client.chat.completions.create(
|
19 |
+
model="meta-llama/Llama-3.1-8B-Instruct",
|
20 |
+
messages=messages,
|
21 |
+
max_tokens=500
|
22 |
+
)
|
23 |
+
|
24 |
+
response = completion.choices[0].message["content"]
|
25 |
return response
|
26 |
|
27 |
demo = gr.Interface(
|