Spaces:
Running
Running
Diego Carpintero
commited on
Commit
•
602dc44
1
Parent(s):
9c14b7b
refactor
Browse files- minerva.py → agents.py +2 -2
- app.py +4 -4
minerva.py → agents.py
RENAMED
@@ -15,9 +15,9 @@ import yaml
|
|
15 |
|
16 |
from tools import Tools
|
17 |
|
18 |
-
class
|
19 |
"""
|
20 |
-
|
21 |
"""
|
22 |
|
23 |
def __init__(self, config_path: str = "config/agents.yaml"):
|
|
|
15 |
|
16 |
from tools import Tools
|
17 |
|
18 |
+
class MinervaTeam:
|
19 |
"""
|
20 |
+
Minerva Team tasked with Scam Protection using an Agentic Workflow
|
21 |
"""
|
22 |
|
23 |
def __init__(self, config_path: str = "config/agents.yaml"):
|
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from PIL import Image
|
2 |
import gradio as gr
|
3 |
|
4 |
-
from
|
5 |
from formatter import AutoGenFormatter
|
6 |
|
7 |
|
@@ -33,7 +33,7 @@ outputs = [
|
|
33 |
examples = "examples"
|
34 |
example_labels = ["EN:Gift:Social", "ES:Banking:Social", "EN:Billing:SMS", "EN:Multifactor:Email", "EN:CustomerService:Twitter", "NO_TEXT:Landscape.HAM", "FR:OperaTicket:HAM"]
|
35 |
|
36 |
-
|
37 |
formatter = AutoGenFormatter()
|
38 |
|
39 |
def to_html(texts):
|
@@ -45,7 +45,7 @@ def to_html(texts):
|
|
45 |
async def predict(img):
|
46 |
try:
|
47 |
img = Image.fromarray(img)
|
48 |
-
stream = await
|
49 |
|
50 |
streams = []
|
51 |
messages = []
|
@@ -59,7 +59,7 @@ async def predict(img):
|
|
59 |
else:
|
60 |
prediction = "No analysis available. Try again later."
|
61 |
|
62 |
-
await
|
63 |
yield [prediction, to_html(messages)]
|
64 |
|
65 |
except Exception as e:
|
|
|
1 |
from PIL import Image
|
2 |
import gradio as gr
|
3 |
|
4 |
+
from agents import MinervaTeam
|
5 |
from formatter import AutoGenFormatter
|
6 |
|
7 |
|
|
|
33 |
examples = "examples"
|
34 |
example_labels = ["EN:Gift:Social", "ES:Banking:Social", "EN:Billing:SMS", "EN:Multifactor:Email", "EN:CustomerService:Twitter", "NO_TEXT:Landscape.HAM", "FR:OperaTicket:HAM"]
|
35 |
|
36 |
+
agents = MinervaTeam()
|
37 |
formatter = AutoGenFormatter()
|
38 |
|
39 |
def to_html(texts):
|
|
|
45 |
async def predict(img):
|
46 |
try:
|
47 |
img = Image.fromarray(img)
|
48 |
+
stream = await agents.analyze(img)
|
49 |
|
50 |
streams = []
|
51 |
messages = []
|
|
|
59 |
else:
|
60 |
prediction = "No analysis available. Try again later."
|
61 |
|
62 |
+
await agents.reset()
|
63 |
yield [prediction, to_html(messages)]
|
64 |
|
65 |
except Exception as e:
|