This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encrypt(plaintext, key): | |
cyphertext = '' | |
for character in plaintext: | |
if character.isalpha(): | |
number = ord(character) | |
number += key | |
if character.isupper(): | |
if number > ord('Z'): | |
number -= 26 | |
elif number < ord('A'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from caesar_encryption import encrypt | |
def caesar(): | |
key = 1 | |
is_error = False | |
for index, arg in enumerate(sys.argv): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from caesar_encryption import encrypt | |
def caesar(): | |
parser = argparse.ArgumentParser() | |
group = parser.add_mutually_exclusive_group() | |
group.add_argument('-e', '--encrypt', action='store_true') | |
group.add_argument('-d', '--decrypt', action='store_true') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
from caesar_encryption import encrypt | |
@click.command() | |
@click.argument('text', nargs=-1) | |
@click.option('--decrypt/--encrypt', '-d/-e') | |
@click.option('--key', '-k', default=1) | |
def caesar(text, decrypt, key): | |
text_string = ' '.join(text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
from caesar_encryption import encrypt | |
@click.command() | |
@click.option( | |
'--input_file', | |
type=click.File('r'), | |
help='File in which there is the text you want to encrypt/decrypt.' | |
'If not provided, a prompt will allow you to type the input text.', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
import enchant | |
from caesar_encryption import encrypt | |
@click.command() | |
@click.option( | |
'--input_file', | |
type=click.File('r'), | |
required=True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
import enchant | |
from tqdm import tqdm | |
from caesar_encryption import encrypt | |
@click.command() | |
@click.option( | |
'--input_file', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tensorflow.keras.layers import Dense | |
from tensorflow.keras import Model, Input | |
def build_big_model( | |
# small input and output in order to avoid latency due to data transfer through the internet during our tests | |
input_width=10, | |
output_width=10, | |
hidden_layers_width=10**4, | |
nb_hidden_layers=200, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from flask import Flask, request | |
from build_big_model import build_big_model | |
model = build_big_model() | |
app = Flask(__name__) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from locust import HttpLocust, TaskSet, task, between | |
INPUT_WIDTH = 10 | |
class PredictTaskSet(TaskSet): | |
@task(1) | |
def predict(self): | |
payload = { |
OlderNewer