SuccessfulCrab commited on
Commit
8c45b9a
·
verified ·
1 Parent(s): e6d5949

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -6
app.py CHANGED
@@ -14,11 +14,11 @@ execute_firecrawl = firecrawler.FireCrawlTool()
14
 
15
 
16
  agent = CodeAgent(
17
- tools=[execute_firecrawl], model=HfApiModel("meta-llama/Llama-3.3-70B-Instruct"), max_steps=4
18
  )
19
 
20
 
21
- def get_answer(url):
22
  """
23
  A function that takes any question as input and returns the answer using agent.run()
24
 
@@ -28,8 +28,48 @@ def get_answer(url):
28
  Returns:
29
  str: The answer to the question
30
  """
31
- answer = agent.run(url)
32
- answer = answer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  print("Final output:")
34
  print(answer)
35
  return answer
@@ -52,8 +92,8 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
52
  with gr.Row():
53
  with gr.Column(scale=1, min_width=300):
54
  #input_image = gr.Image(label="Upload a suspicious screenshot (email, text message, advertisement etc)", type="pil")
55
- #input_text = gr.Textbox(label="Description", info="Please describe your concerns regarditng the situation",lines=3,value="On Monday the 5th of April...")
56
- input_url = gr.Textbox(label="URLs", info="Please enter a suspicious URL",lines=3,value="http://www.suspicious.xyz")
57
  btn = gr.Button("Process submission")
58
 
59
 
 
14
 
15
 
16
  agent = CodeAgent(
17
+ tools=[execute_firecrawl], model=HfApiModel("meta-llama/Llama-3.3-70B-Instruct"), max_steps=10
18
  )
19
 
20
 
21
+ def get_answer(url, text):
22
  """
23
  A function that takes any question as input and returns the answer using agent.run()
24
 
 
28
  Returns:
29
  str: The answer to the question
30
  """
31
+ answer = agent.run(f'''
32
+ You are a scam detection expert helping users evaluate suspicious online activities. When a user submits a URL and description, follow these steps carefully:
33
+
34
+ STEP 1: URL ANALYSIS
35
+ - Examine: {url}
36
+ - Check for technical red flags:
37
+ * Misspellings or character substitutions in domain names
38
+ * Suspicious TLDs (.xyz, unusual country codes)
39
+ * Recently registered domains
40
+ * HTTP instead of HTTPS
41
+ * URL shorteners or redirects
42
+ * Subdomains that mimic legitimate brands
43
+ - Check for contextual red flags:
44
+ * Mismatch between URL and purported organization
45
+ * URLs claiming to represent government/financial institutions
46
+ * Presence of random strings or numbers
47
+
48
+ STEP 2: SITUATION ASSESSMENT
49
+ - Review user's description: {text}
50
+ - Identify scam patterns:
51
+ * Urgency or pressure tactics mentioned
52
+ * Requests for personal/financial information
53
+ * Unexpected money/prize offers
54
+ * Unsolicited contact methods
55
+ * Requests to download files or install software
56
+ * Claims requiring immediate action to avoid penalties
57
+
58
+ STEP 3: CORRELATION ANALYSIS
59
+ - Connect the URL analysis with the user's description
60
+ - Identify inconsistencies or alignment between the two
61
+ - Determine the likely scam category (phishing, advance fee, tech support, etc.)
62
+
63
+ STEP 4: ACTIONABLE GUIDANCE
64
+ - Provide clear risk assessment (High/Medium/Low)
65
+ - Recommend specific protective actions based on the scenario
66
+ - Suggest reporting mechanisms if applicable (FTC, IC3, company fraud departments)
67
+ - Offer general education about this specific type of scam
68
+ - Explain what legitimate alternatives would look like
69
+
70
+ Always prioritize user safety. If uncertain, err on the side of caution.'''
71
+ )
72
+
73
  print("Final output:")
74
  print(answer)
75
  return answer
 
92
  with gr.Row():
93
  with gr.Column(scale=1, min_width=300):
94
  #input_image = gr.Image(label="Upload a suspicious screenshot (email, text message, advertisement etc)", type="pil")
95
+ input_url = gr.Textbox(label="Description", info="Please describe your concerns regarditng the situation",lines=3,value="On Monday the 5th of April...")
96
+ input_text = gr.Textbox(label="URLs", info="Please enter a suspicious URL",lines=3,value="http://www.suspicious.xyz")
97
  btn = gr.Button("Process submission")
98
 
99