zzmez commited on
Commit
491fe7e
·
1 Parent(s): 59961c2

feat: added plotting tab

Browse files
Files changed (1) hide show
  1. app.py +35 -92
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
- domains_template = """tenderax.com
18
- reach-fortune.com
19
- joyful-healthy-hair.com
20
- roadbastion.com
21
- telesellshow.com
22
- quoteinalley.com
23
- pulsetrens.com
24
- conzurup.com
25
- enhancexp.com
26
- crystaldump.com
27
- wizuite.com
28
- rental-navigate.com
29
- habitatbutler.com
30
- equir-group.com
31
- gardenscented.com
32
- send-xp.com
33
- muzicarea.com
34
- markiq-brand.com
35
- oceanoger.com
36
- sagepagecos.com
37
- onestopdistribute.com
38
- zotep.com
39
- social-ascend.com
40
- sorganbell.com
41
- dotbokeeping.com
42
- prentior.com
43
- allign-simple.com
44
- healthskoot.com
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))