Beispiel #1
0
def main():
    args = cmd_line.parse_args()

    util.init(args)
    util.pre_problem = 'CV RC circle'

    logger = logging.getLogger()
    log.configure_logger(logger, "RaceCar")
    logger.setLevel(logging.DEBUG)
Beispiel #2
0
def main():
    configure_logger(__name__,
                     level=logging.INFO,
                     bot_token=TOKEN,
                     chat_id=os.getenv('CHAT_ID'))
    while True:
        try:
            updater = Updater(TOKEN)
            dp = updater.dispatcher
            dp.add_handler(CommandHandler('start', start))
            dp.add_handler(MessageHandler(Filters.text, echo))
            updater.start_polling()
            logging.info('Бот запущен')
            updater.idle()
        except Exception as exc:
            logger.error('Bot has been crashed')
            logger.exception(err)
Beispiel #3
0
def main():
    configure_logger()
    use_cuda = torch.cuda.is_available()
    device = torch.device("cuda:0" if use_cuda else "cpu")

    labels = {format(i, "05d"): i for i in range(1, SAMPLE_NUMBER + 1)}
    all_ids = list(labels.keys())
    partition = dataset.split(all_ids)

    # Dataset loading params
    params = {'batch_size': 64, 'shuffle': True, 'num_workers': 6}

    logger.info("Generating training set...")
    training_set = FlyingChairsDataset(DATA_FOLDER, partition["train"])
    training_generator = data.DataLoader(training_set, **params)

    logger.info("Generating validation set...")
    validation_set = FlyingChairsDataset(DATA_FOLDER, partition["val"])
    validation_generator = data.DataLoader(validation_set, **params)

    logger.info("Starting training")

    max_epochs = 10
    for epoch in range(max_epochs):
        logger.info("Epoch {}".format(epoch))
        for img1, img2, flo in training_generator:
            # Transfer to GPU
            img1, img2, flo = img1.to(device), img2.to(device), flo.to(device)

            # Model computations
            print("I did it i feel like i went through a portal")

        # Validation
        with torch.set_grad_enabled(False):
            for img1, img2, flo in validation_generator:
                # Transfer to GPU
                img1, img2, flo = img1.to(device), img2.to(device), flo.to(
                    device)

                # Model computations
                print("I'm here")
Beispiel #4
0
def main():
    load_dotenv()
    logging.basicConfig(level=logging.WARNING)

    project_id = os.getenv('DIALOGFLOW_PROJECT_ID')
    vk_token = os.getenv('VK_TOKEN')
    logger_bot_token = os.getenv('LOGGER_TOKEN')
    logger_bot_chat_id = os.getenv('LOGGER_CHAT_ID')

    configure_logger(__file__,
                     level=logging.INFO,
                     bot_token=logger_bot_token,
                     chat_id=logger_bot_chat_id)

    while True:
        try:
            run_chatbot(vk_token, project_id)

        except Exception as err:
            logger.error(f'Бот "{__file__}" упал с ошибкой.')
            logger.exception(err)

            continue
Beispiel #5
0
 def __init__(self):
     self.start = 0
     self.SECONDS_BY_PASS = 10
     self.HASH_THRESHOLD = 5
     self.last_screenshot = None
     self.log = configure_logger("GameWatcher")
     self.WHITELIST_FILENAME = "whitelist.txt"
     self.HOURS_TIME_FILENAME = "played_1.json"
     self.DATE_FORMAT = "%Y-%m-%d-%H-%M-%S"
     self.played_games = {}
     try:
         self.played_games = json.load(open(self.HOURS_TIME_FILENAME))
     except Exception as e:
         pass
Beispiel #6
0
__status__     = "Production"

import os
import sqlite3
import urllib.request as url

try:
    import log
    import databaseConsume          as SQL 
    import constants                as CONS
except:
    import module.log               as log
    import module.databaseConsume   as SQL
    import module.constants         as CONS

logger = log.configure_logger('default')

class Initial_Configuration():
    """
    Class to check and set the initial configuration Device 
    @params  : NONE
    @returns : (int) The class returns the state of configuiration 
                To do so, create the constructor , and call the function 
                check_configuration. This Module can retorn a number from 0 to 5
                depending in the state of the configuration:
    - 0 - Device coudnt be configured (Denied Permition or missing data)
    - 1 - Device with data in DB
    - 2 - No wifi DATA
    - 3 - No Contenedors DATA

    - 5 - StandBy device (Waiting For modifications)
Beispiel #7
0
import json
import random
import re
import requests
import sets
from gpsoauth import perform_master_login, perform_oauth

import settings
import log
logger = log.configure_logger(__name__)

TIMEOUT = 3.1


class AccessToken:
    def __init__(self, credentials, value):
        self.provider = credentials[0]
        self.username = credentials[1]
        self.password = credentials[2]
        self.value = value


class Google:
    ANDROID_ID = '9774d56d682e549c'
    APP = 'com.nianticlabs.pokemongo'
    CLIENT_SIG = '321187995bc7cdc2b5fc91b11a96e2baa8602c62'
    SERVICE = 'audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com'

    def __init__(self):
        pass
Beispiel #8
0
def test():

    args = cmd_line.parse_args()

    util.prefix_init(args)
    util.pre_problem = 'RC'

    logger = logging.getLogger()
    log.configure_logger(logger, "Test RaceCar FS rectangle")
    logger.setLevel(logging.DEBUG)

    points = [(120, 40), (210, 40), (210, 180), (30, 180), (30, 40)]
    NUM_JUNCTURES = 50
    NUM_MILESTONES = 50
    NUM_LANES = 5
    MAX_SPEED = NUM_SPEEDS = 3
    NUM_DIRECTIONS = 20

    NUM_STEER_POSITIONS = 3
    NUM_ACCEL_POSITIONS = 3

    WIDTH = 20
    track = LineTrack(points, WIDTH, NUM_JUNCTURES, NUM_MILESTONES, NUM_LANES)
    #track.draw()

    NUM_SPEEDS = 3
    car = Car(NUM_DIRECTIONS, NUM_SPEEDS)

    MY_IDEAL_A = [
        (1, 2),
        (1, 2),
        (1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        #(1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        #(1, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (0, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
    ]
    #     logger.debug("About to drive manual")

    driver = ManualDriver(NUM_JUNCTURES, NUM_LANES, NUM_SPEEDS, NUM_DIRECTIONS,
                          NUM_STEER_POSITIONS, NUM_ACCEL_POSITIONS, MY_IDEAL_A)

    total_R, environment = driver.run_episode(track, car)
    logger.debug("Total_R: %s", total_R)
    environment.report_history()
    environment.play_movie(save=False, pref="bestmovie")
Beispiel #9
0
import os
from fastapi import FastAPI, File, UploadFile
import uvicorn
import log
import uuid
import yaml

app = FastAPI()
_path = "tmp"
logger = log.configure_logger("main", "stt")


@app.on_event("startup")
async def startup_event():
    global stt_obj
    try:
        import stt_project.stt_inference as stt
        stt_obj = stt.Model()
        logger.info(f'! STT-SERVER START')
    except Exception as ex:
        logger.info(f'! STT-SERVER Err: {ex}')


@app.post('/stt')
async def stt(uploadFile: UploadFile = File(...)):
    try:
        request_id = str(uuid.uuid4())
        logger.info(f'{request_id} - Request')
        file_name = f'{_path}/{request_id}.wav'

        with open(file_name, 'wb') as f:
Beispiel #10
0
def test():

    args = cmd_line.parse_args()

    util.prefix_init(args)
    util.pre_problem = 'RC'

    logger = logging.getLogger()
    log.configure_logger(logger, "Test RaceCar FS")
    logger.setLevel(logging.DEBUG)
    
    NUM_JUNCTURES = 28
    NUM_MILESTONES = 27
    NUM_LANES = 5
    MAX_SPEED = NUM_SPEEDS = 3
    NUM_DIRECTIONS = 20
    
    NUM_STEER_POSITIONS = 3
    NUM_ACCEL_POSITIONS = 3

    RADIUS = 98
    track = CircleTrack((0, 0), RADIUS, 20, NUM_JUNCTURES,
                        NUM_MILESTONES, NUM_LANES)
    NUM_SPEEDS = 3
    car = Car(NUM_DIRECTIONS, NUM_SPEEDS)

    MY_IDEAL_A = [
            (0, 2),
            (1, 2),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (1, 1),
            (0, 1),
            (0, 1),
            (0, 1),
        ]

    environment = Environment(track, car, NUM_JUNCTURES,
                              should_record=True)
    driver = ManualDriver(
        NUM_JUNCTURES,
        NUM_LANES,
        NUM_SPEEDS,
        NUM_DIRECTIONS,
        NUM_STEER_POSITIONS,
        NUM_ACCEL_POSITIONS,
        MY_IDEAL_A)
    total_R, environment = driver.run_episode(track, car)
    logger.debug("Total_R: %s", total_R)
    environment.report_history()
    environment.play_movie(save=False, pref="bestmovie")
def main():
    configure_logger()
    network = Network()
Beispiel #12
0
import json
import random
import re
import requests
import sets
from gpsoauth import perform_master_login, perform_oauth

import settings
import log
logger = log.configure_logger(__name__)

TIMEOUT = 3.1

class AccessToken:
    def __init__(self, credentials, value):
        self.provider = credentials[0]
        self.username = credentials[1]
        self.password = credentials[2]
        self.value = value


class Google:
    ANDROID_ID = '9774d56d682e549c'
    APP = 'com.nianticlabs.pokemongo'
    CLIENT_SIG = '321187995bc7cdc2b5fc91b11a96e2baa8602c62'
    SERVICE = 'audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com'

    def __init__(self):
        pass

    def login(self, username, password):
Beispiel #13
0
class DataExtractorJSONEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, Decimal):
            return float(o)
        return json.JSONEncoder.default(self, o)


class DEConfig:
    RESTFUL_JSON = {"cls": DataExtractorJSONEncoder}


de_health = HealthCheck()

app = Flask(DE_APPLICATION_NAME)
configure_logger(app.logger, logging.INFO, DE_LOG_FILE_PATH)
create_logger(DE_LOG_FILE_PATH)
app.config.from_object(DEConfig)
CORS(app)

api = Api(app, catch_all_404s=True)



# Extract data API for Machines and Scanned PDF.
# api.add_resource(ExtractData, "/extract/data")

# Flask route to expose Health Check information
app.add_url_rule("/healthcheck", "healthcheck", view_func=lambda: de_health.run())

Beispiel #14
0
import os
from fastapi import FastAPI
import uvicorn
import log
import uuid
import yaml
import base64
import soundfile as sf

app = FastAPI()
_path = "tmp"
logger = log.configure_logger("main", "tts")


@app.on_event("startup")
async def startup_event():
    global tts_obj
    try:
        import tts_project.tts_inference as tts
        tts_obj = tts.Model()
        logger.info(f'! TTS-SERVER START')
    except Exception as ex:
        logger.info(f'! TTS-SERVER Err: {ex}')


@app.post('/tts')
async def tts(msg):
    try:
        request_id = str(uuid.uuid4())
        logger.info(f'{request_id} - Request')
        tts_obj.predict(msg)