Skip to content

Commit

Permalink
1.6 Release Check Released for CL
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchie0x4ff committed Aug 20, 2019
1 parent 5ab9f1a commit 1f2eae5
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 45 deletions.
51 changes: 28 additions & 23 deletions easymodels/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
import argparse
import sys
import os

parser = argparse.ArgumentParser()
parser.add_argument('-gd', '--gui-dark', help='Start with GUI in Dark Mode and Set To Default', action='store_true')
parser.add_argument('-g', '--gui', help='Start with GUI in Light Mode and Set To Default', action='store_true')
args = parser.parse_args()
from crayons import *


__version__ = "1.5.1"
__version__ = "1.6"

def create_config():
with open('config.ini', 'w') as f:
Expand All @@ -23,23 +19,32 @@ def create_config():


def start():
if args.gui_dark == True:
dark = True
args.gui = True
else:
dark = False
sys.stdout.flush()
print('Checking For Updates...')
r = requests.get('https://raw.githubusercontent.com/M4cs/EasyModels/master/version.txt').text.replace('\n', '').replace('\r', '')
print(r)
if r != __version__:
print('Update Available Please Run "pip install easymodels --upgrade --no-cache-dir" to update to the latest version!')
time.sleep(1)
else:
print('All Up To Date! Starting EasyModels')
if args.gui:
GUI.gui(dark=dark)
Menu.main()
parser = argparse.ArgumentParser()
parser.add_argument('-gd', '--gui-dark', help='Start with GUI in Dark Mode and Set To Default', action='store_true')
parser.add_argument('-g', '--gui', help='Start with GUI in Light Mode and Set To Default', action='store_true')
parser.add_argument('-d', '--disable-update', help='Start without checking for updates.', action='store_true')
args = parser.parse_args()
try:
if args.gui_dark == True:
dark = True
args.gui = True
else:
dark = False
sys.stdout.flush()
if args.disable_update == False:
print(yellow('Checking For Updates...', bold=True))
r = requests.get('https://raw.githubusercontent.com/M4cs/EasyModels/master/version.txt').text.replace('\n', '').replace('\r', '')
if r != __version__:
print(green('Update Available Please Run "pip install easymodels --upgrade --no-cache-dir" to update to the latest version!', bold=True))
time.sleep(1)
else:
print(green('All Up To Date! Starting EasyModels', bold=True))
if args.gui:
GUI.gui(dark=dark)
print(green('Starting EasyModels...', bold=True))
Menu.main()
except KeyboardInterrupt:
print(red('Exiting...', bold=True))

if __name__ == "__main__":
start()
8 changes: 4 additions & 4 deletions easymodels/utils/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from terminaltables import AsciiTable
from .constants import *
from webbrowser import open_new_tab

from crayons import *
test = r.get(API_URL + 'categories/', headers=HEADERS)


Expand All @@ -23,13 +23,13 @@ def get_category_info(category):

@staticmethod
def categories_to_table():
categories = Categories.get_all_categories()
categories = {'computer-vision': {'id': 1, 'slug': 'computer-vision', 'title': 'Computer Vision', 'short_title': 'CV', 'description': 'Computer Vision: Object detection, boundary labelling, segmentation.'}, 'natural-language-processing': {'id': 2, 'slug': 'natural-language-processing', 'title': 'Natural Language Processing', 'short_title': 'NLP', 'description': 'Natural Language Processing (NLP).'}, 'generative-models': {'id': 3, 'slug': 'generative-models', 'title': 'Generative Models', 'short_title': 'Generative', 'description': 'Generative Models, such as Generative Adversarial Networks (GANs), Variational Autoencoders (VAE), and more.'}, 'reinforcement-learning': {'id': 4, 'slug': 'reinforcement-learning', 'title': 'Reinforcement Learning', 'short_title': 'RL', 'description': 'Where an agent learn how to behave in a environment by performing actions and seeing the results.'}, 'unsupervised-learning': {'id': 5, 'slug': 'unsupervised-learning', 'title': 'Unsupervised Learning', 'short_title': 'Unsupervised', 'description': 'Unsupervised learning is a type of machine learning algorithm to draw inferences from datasets consisting of input data without labels.'}, 'audio-speech': {'id': 6, 'slug': 'audio-speech', 'title': 'Audio and Speech', 'short_title': 'Audio', 'description': 'Models and code that perform audio processing, speech synthesis, and other audio related tasks.'}}
table_data = [
['ID#', 'Title', 'Description']
]
count = 0
for k, v in categories.items():
table_data.append([count, v['title'], v['description']])
table_data.append([str(blue(str(count), bold=True)), str(green(str(v['title']), bold=True)), str(white(str(v['description'][0:100]), bold=True))])
count += 1
table = AsciiTable(table_data, 'Categories')
return table.table
Expand Down Expand Up @@ -71,7 +71,7 @@ def create_table_from_category_info(category_info):
['ID#', 'Title', 'Description', 'GitHub Link', 'Framework']
]
while count <= (len(titles) - 1):
table_data.append([count, titles[count], descriptions[count], links[count], frameworks[count]])
table_data.append([str(blue(str(count), bold=True)), str(blue(str(titles[count]), bold=True)), str(white(str(descriptions[count]), bold=True)), str(green(str(links[count]), bold=True)), str(yellow(str(frameworks[count]), bold=True))])
count += 1
table = AsciiTable(table_data, 'Available Models')
return table.table
Expand Down
22 changes: 11 additions & 11 deletions easymodels/utils/menu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .categories import Categories
import sys

from crayons import *
class Menu:

@staticmethod
Expand All @@ -14,29 +14,29 @@ def main():
'5': 'audio-speech'
}
while True:
print("""\
print(white("""\
\n\n
EasyModels v1.5.1\n
EasyModels v1.6\n
\tEasyModels is a tool to quickly, and easily find pre-trained AI
\tmodels for your project. It uses the modelzoo.co API and offers
\tinformation about the pre-trained models in an easy to view way.
Created By: @maxbridgland\n""")
Created By: @maxbridgland\n""", bold=True))
print(Categories.categories_to_table())
print('\nPlease Choose A Category by ID # From Above To Find Models or Type "exit" to Exit the Program\n')
category_id = input('$easymodels~ ')
print(white('\nPlease Choose A Category by ID # From Above To Find Models or Type "exit" to Exit the Program\n', bold=True))
category_id = input(green('$easymodels~ ', bold=True))
if category_id.lower() == 'exit':
sys.exit()
else:
if not cat_to_id.get(category_id):
print('\nInvalid Option! Please choose an ID # from the table above!\n')
print(red('\nInvalid Option! Please choose an ID # from the table above!\n', bold=True))
else:
print('\nGrabbing Models Based On Choice...\n')
print(green('\nGrabbing Models Based On Choice...\n',bold=True))
category_info = Categories.get_category_info(cat_to_id[category_id])
print(Categories.create_table_from_category_info(category_info))
print('\nPlease Choose A Project by ID # From Above To Find Models or Type "exit" to Exit the Program\n')
print(white('\nPlease Choose A Project by ID # From Above To Find Models or Type "exit" to Exit the Program\n', bold=True))
while True:
model_id = input('$easymodels~ ')
model_id = input(green('$easymodels~ ', bold=True))
if model_id.lower() == "exit":
break
else:
Expand All @@ -46,6 +46,6 @@ def main():
break
except:
print(Categories.create_table_from_category_info(category_info))
print('\nInvalid Option! Please choose an ID # from the table above!\n')
print(red('\nInvalid Option! Please choose an ID # from the table above!\n', bold=True))
sys.stdout.flush()

11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ def readme():

setuptools.setup(
name="EasyModels",
version="1.5.1",
version="1.6",
author="Max Bridgland",
install_requires=[
'requests==2.21.0',
'terminaltables==3.1.0',
'PySimpleGUIQt==0.26.0',
'PySide2==5.13.0'
'requests>=2.21.0',
'terminaltables>=3.1.0',
'PySimpleGUIQt>=0.26.0',
'PySide2>=5.13.0',
'crayons>=0.2.0'
],
author_email="[email protected]",
description="Command Line User Interface for finding pre-trained AI models",
Expand Down
2 changes: 1 addition & 1 deletion upload.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python setup.py sdist bdist_wheel && twine upload ./dist/*
python3 setup.py sdist bdist_wheel && twine upload ./dist/*
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1
1.6

0 comments on commit 1f2eae5

Please sign in to comment.