-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathape_guard_app.py
47 lines (42 loc) · 1.41 KB
/
ape_guard_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
46
47
import streamlit as st
import random
from ape_guard import do_magic, do_magic_2
import cv2
import matplotlib.pyplot as plt
from io import StringIO
logo = cv2.imread("res/ape_up.png")
logo = cv2.cvtColor(logo, cv2.COLOR_BGR2RGB)
logo = cv2.resize(logo, (200, 200))
st.image(logo)
st.title('Ape Together Strong')
st.write('Ape Scout will venture into the chain for ya')
user_input = st.text_input('Contract Address')
bot = st.button('APE Scout!')
st.write('Ape Reader can read your contract')
uploaded_file = st.file_uploader("Choose a file")
bot2 = st.button('APE Read!')
if bot:
st.title("Your ape going places - not the moon but places")
magic = do_magic(user_input)
if bot2:
if uploaded_file is not None:
st.title("Quiet! Ape Reading")
string = StringIO(uploaded_file.getvalue().decode("utf-8")).read()
magic = do_magic_2(string)
else:
bot2 = False
if bot or bot2:
st.title("Your ape is back!")
if magic["score"] <5:
logo = cv2.imread("res/ape_dead.png")
logo = cv2.cvtColor(logo, cv2.COLOR_BGR2RGB)
logo = cv2.resize(logo, (200, 200))
st.image(logo)
else:
logo = cv2.imread("res/ape_up.png")
logo = cv2.cvtColor(logo, cv2.COLOR_BGR2RGB)
logo = cv2.resize(logo, (200, 200))
st.image(logo)
for k in magic.keys():
st.write(f'found {magic[k]} - {k}')
st.write(f'{magic["score"]}/10 - overall security')