feat: added plotting tab
Browse files
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
from utils.gradio_utils import *
|
3 |
import os
|
4 |
-
|
|
|
|
|
5 |
|
6 |
USER = os.getenv("USERNAME")
|
7 |
PASS = os.getenv("PASSWORD")
|
@@ -14,96 +16,34 @@ list_iface = gr.Interface(fn=compute_offer,
|
|
14 |
],
|
15 |
outputs="dataframe")
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
busadminister.com
|
46 |
-
roboryzor.com
|
47 |
-
theadaptivetrips.com
|
48 |
-
neat-true.com
|
49 |
-
race-move.com
|
50 |
-
chap-views.com
|
51 |
-
sunysuites.com
|
52 |
-
willpowersocial.com
|
53 |
-
avantezores.com
|
54 |
-
snortbears.com
|
55 |
-
avatarctica.com
|
56 |
-
realbloxes.com
|
57 |
-
tradessprint.com
|
58 |
-
pulsecoverage.com
|
59 |
-
devicesco.com
|
60 |
-
skyward-bill-board.com
|
61 |
-
match-salon-finder.com
|
62 |
-
appcanister.com
|
63 |
-
natural-dermi-cool.com
|
64 |
-
appotor.com
|
65 |
-
kid-pocket.com
|
66 |
-
cebnext.com
|
67 |
-
inno-crista.com
|
68 |
-
craftitbyhand.com
|
69 |
-
taveas.com
|
70 |
-
pro-story-anthology.com
|
71 |
-
textropolitan.com
|
72 |
-
decorld.com
|
73 |
-
knockand-blok.com
|
74 |
-
stratusdomain.com
|
75 |
-
cloriyes.com
|
76 |
-
intromobs.com
|
77 |
-
funnygrids.com
|
78 |
-
bright-seen.com
|
79 |
-
close-stop.com
|
80 |
-
lets-tech.com
|
81 |
-
globehereme.com
|
82 |
-
lemon-abode.com
|
83 |
-
skyzark.com
|
84 |
-
tracwares.com
|
85 |
-
extraclubs.com
|
86 |
-
magicspix.com
|
87 |
-
technayas.com
|
88 |
-
queltys.com
|
89 |
-
meta-choose.com
|
90 |
-
salesultrax.com
|
91 |
-
travelingnarrative.com
|
92 |
-
domtions.com
|
93 |
-
rising-beats.com
|
94 |
-
vintacrafts.com
|
95 |
-
blaze-trophy.com
|
96 |
-
clever-wiz.com
|
97 |
-
encraftey.com
|
98 |
-
canvats.com
|
99 |
-
ad-nu-vu.com
|
100 |
-
thehandshops.com
|
101 |
-
craft-pleasure.com
|
102 |
-
patio-style-chef.com
|
103 |
-
rollerdip.com
|
104 |
-
skilled-code.com
|
105 |
-
atomic-boom.com
|
106 |
-
thedropgears.com"""
|
107 |
|
108 |
|
109 |
with gr.Blocks() as aeon:
|
@@ -164,10 +104,13 @@ with gr.Blocks() as aeon:
|
|
164 |
reset_btn = gr.ClearButton(label="Reset", components=[ip_subclasses_raw, domains_raw])
|
165 |
with gr.Column():
|
166 |
mix_btn = gr.Button("Mix IPs and Domains")
|
167 |
-
mix_btn.click(fn=mix, inputs=[domains_raw, output_ips, num_of_ips]
|
168 |
outputs=output_mix)
|
169 |
|
170 |
with gr.Tab(label="Top Lists"):
|
171 |
list_iface.render()
|
|
|
|
|
|
|
172 |
|
173 |
aeon.launch(auth=(USER, PASS))
|
|
|
1 |
import gradio as gr
|
2 |
from utils.gradio_utils import *
|
3 |
import os
|
4 |
+
import pandas as pd
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import seaborn as sns
|
7 |
|
8 |
USER = os.getenv("USERNAME")
|
9 |
PASS = os.getenv("PASSWORD")
|
|
|
16 |
],
|
17 |
outputs="dataframe")
|
18 |
|
19 |
+
# PLOTTING
|
20 |
+
def plot_df(filename):
|
21 |
+
# Read the file into a pandas DataFrame
|
22 |
+
df = pd.read_csv(filename.name)
|
23 |
+
df["timeLogged"] = pd.to_datetime(df["timeLogged"])
|
24 |
+
zztitle = filename.name.split('_')[1]
|
25 |
+
|
26 |
+
fig, ax = plt.subplots(figsize=(20, 10))
|
27 |
+
sns.lineplot(x='timeLogged', y='delivered', hue='dlvSourceIp', data=df.reset_index())
|
28 |
+
# set x axis extract only hour and minute from datetime
|
29 |
+
ax.set_title(zztitle)
|
30 |
+
ax.set_ylabel('Number of emails delivered')
|
31 |
+
ax.set_xlabel('Date')
|
32 |
+
ax.legend(loc='upper left')
|
33 |
+
# allign ticks at 45 degrees
|
34 |
+
plt.xticks(rotation=90)
|
35 |
+
return fig
|
36 |
+
|
37 |
+
|
38 |
+
plt_iface = gr.Interface(fn=plot_df,
|
39 |
+
inputs=gr.File(label="Upload CSV", type="file"),
|
40 |
+
outputs=gr.Plot())
|
41 |
+
|
42 |
+
|
43 |
+
###
|
44 |
+
domains_template = """
|
45 |
+
example.com
|
46 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
with gr.Blocks() as aeon:
|
|
|
104 |
reset_btn = gr.ClearButton(label="Reset", components=[ip_subclasses_raw, domains_raw])
|
105 |
with gr.Column():
|
106 |
mix_btn = gr.Button("Mix IPs and Domains")
|
107 |
+
mix_btn.click(fn=mix, inputs=[domains_raw, output_ips, num_of_ips],
|
108 |
outputs=output_mix)
|
109 |
|
110 |
with gr.Tab(label="Top Lists"):
|
111 |
list_iface.render()
|
112 |
+
|
113 |
+
with gr.Tab(label="Plot"):
|
114 |
+
plt_iface.render()
|
115 |
|
116 |
aeon.launch(auth=(USER, PASS))
|