Coder Social home page Coder Social logo

alejandrods / cover-letter-generator-gpt2 Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 5.0 178 KB

Service for generating cover letter using GPT-2 model, deployed on Google Cloud.

Home Page: https://cover-letter-generator-gpt2-app-6q7gvhilqq-lz.a.run.app

Dockerfile 10.39% Python 45.95% JavaScript 42.78% Shell 0.88%
artificial-intelligence cover-letter google-cloud-platform gpt2 machine-learning programming python pytorch text-generation

cover-letter-generator-gpt2's Introduction

Hi, my name is Alex πŸ‘‹

My website: Website

I'm a Machine Learning Engineer, Aeronautical Engineer, Teacher and Climber!

  • πŸ“š Machine Learning Engineer holding a Master's degree by the University of Sydney.
  • πŸ”­ I’m taking a course of Redis
  • ✍ I’m looking to write more articles on Medium
  • ⚑ Fun fact: I love to climb and travel and I'm currently living in Australia β˜€οΈ

Connect with me:

https://alejandrods.github.io alejandrods | LinkedIn alejandrods | Medium

Languages and Tools:

Python

Keras

TensorFlow

PyTorch

GoogleCloud

AWS

SQL

Cpp

HTML5

javascript

matlab

git




πŸ“• Latest Projects

  • Analysis of robust classification algorithms for overcoming class-dependant labelling noise: Forward, Importance Re-weighting and T-revision - Code! πŸ’»
  • Analysis of the robustness of non-negative matrix factorization (NMF) techniques: L2-norm, L1-norm, and L2,1-norm - Code! πŸ’»
  • Generating cover letters with the GPT-2 model - Deployed on Google Cloud - Try it here! πŸ•ΉοΈ
  • Named Entity Recognition in travel-related documents using RNN - Deployed on Google Cloud - Try it here! ✈️
  • Call Center to analyze automatically if a person can be infected with Coronavirus - AWS Connect + AWS Lex Bot - Call me! - +61 2 8311 7630 πŸ“ž
  • Service for generating text with the GPT-2 model - Deployed on Google Cloud - Try it here! πŸ–¨οΈ
  • Alexa Skill using Lambda Functions and Web Scraping - Try it here! πŸ€–

πŸ“• Latest Blog Posts

Anurag's github stats

cover-letter-generator-gpt2's People

Contributors

alejandrods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cover-letter-generator-gpt2's Issues

Google Colab

Do you know how I can run this on Google Colab?

`# -*- coding: utf-8 -*-

import os
import json
import flask
import logging
from textblob import TextBlob
from generate import generate
from flask_cors import CORS, cross_origin
from flask_ngrok import run_with_ngrok
from flask import Flask, render_template, url_for
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import DataRequired
import torch
from transformers import GPT2LMHeadModel, GPT2Tokenizer
from flask import Flask, request, render_template
import json


app = flask.Flask(__name__)
CORS(app)
app.config['PROPAGATE_EXCEPTIONS'] = True
app = Flask(__name__, root_path='/content/cover-letter-generator-gpt2')
app.config['SECRET_KEY'] = '9bad6913d4358ac1395c5c94370ed090'
run_with_ngrok(app)
print(app.root_path)

# Logs
logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s :: %(levelname)s :: %(message)s')


# Load Environment Variables
ROUTE_GENERATE = os.environ.get('ROUTE_GENERATE', 'generate')
N_TOKENS = int(os.environ.get('N_TOKENS', 20))

# This create a json file with the environment variables for javascript script
data_env = {
    "APP_URL": "{}:{}".format(HOST, PORT) if 'localhost' in HOST
    else "{}".format(HOST),
    "ROUTE": "/{}".format(ROUTE_GENERATE),
}

# Save env.json file
with open(os.path.join("/content/cover-letter-generator-gpt2/src/static", "env.json"), 'w') as f:
    json.dump(data_env, f)


@app.route('/content/cover-letter-generator-gpt2/src/templates/main.html')
@cross_origin()
def index():
    """
    Function to render the html file

    :return:
    """

    return flask.render_template('main.html')


@app.route('/generate', methods=['POST'])
@cross_origin()
def prediction():
    """
    Function to receive an user query and return generated text

    :return: Generated text
    """

    income_query = json.loads(flask.request.data)['input']

    logging.info('Query received: {}'.format(income_query))

    arg_lang = TextBlob(income_query)
    lang = arg_lang.detect_language()
    logging.info('Lang detected: {}'.format(lang))

    if lang == 'en':
        res = generate(income_query, size=N_TOKENS)
        generated = res.split(income_query)[-1]
    else:
        res = "lang_det_err"
        generated = "lang_det_err"

    logging.info('Result: {}'.format(res))

    return flask.jsonify({
        'version': 'v1.0.0',
        'body': {'query': income_query,
                 'generated': generated,
                 'result': res}
        }), 200


@app.route('/health_liveness')
@cross_origin()
def health_check():
    """
    Check status code

    :return:
    """

    return flask.jsonify({'status': 'success'}), 200


if __name__ == "__main__":
    app.run()
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.