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 from_label_studio_to_dataframe( LABEL_STUDIO_URL="", | |
API_KEY=""): | |
''' | |
Goals: | |
- Load the labeled data from Label Studio | |
(or from a raw_data dictionary saved locally as a pickle file), clean it, and save it into a panda data frame | |
Attributes: | |
- LABEL_STUDIO_URL (url as string): the url for the label studio project you want to get your data from | |
- API_KEY (string): your Label Studio API_KEY | |
Returns: |
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 the flask app from __init__.py | |
from digitReader import app | |
if __name__ == '__main__': | |
# Running the app | |
app.run(debug=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
# Flask | |
from flask import render_template, request, jsonify | |
from digitReader import app | |
# Utils | |
import base64 | |
from io import BytesIO | |
# Image Processing | |
import cv2 |
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 Flask | |
from flask import Flask | |
# Iniiate the flask app | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = 'Here you put a secret key as a string' | |
# Call the routes code | |
from digitReader import routes |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Optional JavaScript --> | |
<!-- jQuery first, then Popper.js, then Bootstrap JS --> |
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 keras.models import load_model | |
model_name_ = "Model's Name" | |
model = load_model(f'{PATH}/{model_name_}') | |
# EX : say you have the model in a folder called "models" and model's name is "myModel.model" | |
model_name_ = "myModel.model" | |
model = load_model(f'models/{model_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
agent.tensorboard.step = episode |
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
# Use this line to update the log file: | |
agent.tensorboard.update_stats(reward_avg=average_reward, reward_min=min_reward, reward_max=max_reward, epsilon=epsilon) |
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
# Fit on all samples as one batch, log only on terminal state | |
self.model.fit(x = np.array(X).reshape(-1, *env.ENVIRONMENT_SHAPE), | |
y = np.array(y), | |
batch_size = MINIBATCH_SIZE, verbose = 0, | |
shuffle=False, callbacks=[self.tensorboard] if terminal_state else None) |
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
# Custom tensorboard object | |
self.tensorboard = ModifiedTensorBoard(name, log_dir="{}logs/{}-{}".format(PATH, name, int(time.time()))) |
NewerOlder