Ismael1-2-3 commited on
Commit
9804479
·
verified ·
1 Parent(s): 316fef8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,11 +7,11 @@ client = InferenceClient(
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
 
@@ -25,10 +25,10 @@ def evaluate_password_strength(password):
25
  return response
26
 
27
  demo = gr.Interface(
28
- evaluate_password_strength,
29
- gr.Textbox(label="Enter your password"),
30
- gr.Textbox(label="Password Strength Evaluation"),
31
- title="Password Strength Evaluator",
32
  description="Get the AI's evaluation of your password strength.",
33
  )
34
 
 
7
  api_key= os.getenv("superSecretKey")
8
  )
9
 
10
+ def evaluate_code_security(code):
11
  messages = [
12
  {
13
  "role": "user",
14
+ "content": f"You are BoxyReviewer. You work for OmniBlocks, a Python IDE. Your job is to review code before it is uploaded to the cloud. Not for bugs, that's the compiler's thing. Your job is to look at the code and make sure none of it is malicious before it gets to OmniBlocks' server. Your response must be formatted in a JSON format. The key 'result' should be either 'Safe' or 'Unsafe'. The key 'reason' should explain your reasoning. Here's the code {code}"
15
  }
16
  ]
17
 
 
25
  return response
26
 
27
  demo = gr.Interface(
28
+ evaluate_code_security,
29
+ gr.Textbox(label="Enter your code"),
30
+ gr.Textbox(label="Code Security Evaluation"),
31
+ title="Code Security Evaluator",
32
  description="Get the AI's evaluation of your password strength.",
33
  )
34