Spaces:
Running
Running
Upload with huggingface_hub
Browse files- README.md +5 -6
- __pycache__/run.cpython-36.pyc +0 -0
- fraud.csv +11 -0
- requirements.txt +1 -0
- run.py +39 -0
- screenshot.png +0 -0
README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: 🔥
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.6
|
8 |
-
app_file:
|
9 |
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
|
2 |
---
|
3 |
+
title: fraud_detector_main
|
4 |
emoji: 🔥
|
5 |
+
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.6
|
9 |
+
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
|
|
|
__pycache__/run.cpython-36.pyc
ADDED
Binary file (1.08 kB). View file
|
|
fraud.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
time,retail,food,other
|
2 |
+
0,109,145,86
|
3 |
+
1,35,87,43
|
4 |
+
2,49,117,34
|
5 |
+
3,127,66,17
|
6 |
+
4,39,82,17
|
7 |
+
5,101,56,79
|
8 |
+
6,100,129,67
|
9 |
+
7,17,88,97
|
10 |
+
8,76,85,145
|
11 |
+
9,111,106,35
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pandashttps://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
|
run.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
import os
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
|
6 |
+
def fraud_detector(card_activity, categories, sensitivity):
|
7 |
+
activity_range = random.randint(0, 100)
|
8 |
+
drop_columns = [
|
9 |
+
column for column in ["retail", "food", "other"] if column not in categories
|
10 |
+
]
|
11 |
+
if len(drop_columns):
|
12 |
+
card_activity.drop(columns=drop_columns, inplace=True)
|
13 |
+
return (
|
14 |
+
card_activity,
|
15 |
+
card_activity,
|
16 |
+
{"fraud": activity_range / 100.0, "not fraud": 1 - activity_range / 100.0},
|
17 |
+
)
|
18 |
+
|
19 |
+
|
20 |
+
demo = gr.Interface(
|
21 |
+
fraud_detector,
|
22 |
+
[
|
23 |
+
gr.Timeseries(x="time", y=["retail", "food", "other"]),
|
24 |
+
gr.CheckboxGroup(
|
25 |
+
["retail", "food", "other"], value=["retail", "food", "other"]
|
26 |
+
),
|
27 |
+
gr.Slider(1, 3),
|
28 |
+
],
|
29 |
+
[
|
30 |
+
"dataframe",
|
31 |
+
gr.Timeseries(x="time", y=["retail", "food", "other"]),
|
32 |
+
gr.Label(label="Fraud Level"),
|
33 |
+
],
|
34 |
+
examples=[
|
35 |
+
[os.path.join(os.path.dirname(__file__), "fraud.csv"), ["retail", "food", "other"], 1.0],
|
36 |
+
],
|
37 |
+
)
|
38 |
+
if __name__ == "__main__":
|
39 |
+
demo.launch()
|
screenshot.png
ADDED