from flask import render_template, jsonify, Flask, redirect, url_for, request
from app import app
import random
import os
# import tensorflow as tf
# import numpy as np
# import sys
# import spacy

# nlp = spacy.load('en')

# sys.path.insert(0, "/content/bert_experimental")

# from bert_experimental.finetuning.text_preprocessing import build_preprocessor
# from bert_experimental.finetuning.graph_ops import load_graph
# restored_graph = load_graph("models/frozen_graph.pb")
# graph_ops = restored_graph.get_operations()
# input_op, output_op = graph_ops[0].name, graph_ops[-1].name
# x = restored_graph.get_tensor_by_name(input_op + ':0')
# y = restored_graph.get_tensor_by_name(output_op + ':0')
# preprocessor = build_preprocessor("./uncased_L-12_H-768_A-12/vocab.txt", 256)
# py_func = tf.numpy_function(preprocessor, [x], [tf.int32, tf.int32, tf.int32], name='preprocessor')
# py_func = tf.numpy_function(preprocessor, [x], [tf.int32, tf.int32, tf.int32])
# sess = tf.Session(graph=restored_graph)
# delimiter = " ||| "

@app.route('/')
def index1():
    return render_template('index.html', title='Home')

	
@app.route('/predict', methods = ['GET', 'POST'])
def upload_file():
   if request.method == 'POST':
      exp_st = request.form.get('exp')
      job_st = request.form.get('job')
      # y_out = sess.run(y, feed_dict={
      #   x: pd.DataFrame([delimiter.join((exp_st, job_st ))], columns=['name'])
      # })
      # doc1 = nlp(exp_st)
      # doc2 = nlp(job_st )
      # y_out2 = doc1.similarity(doc2)
   return render_template('index.html', title='Success', predictions=80, predictions_sp =75, exp=exp_st, job= job_st)


@app.route('/index')
def index():
    return render_template('index.html', title='Home')

@app.route('/map')
def map():
    return render_template('map.html', title='Map')


@app.route('/map/refresh', methods=['POST'])
def map_refresh():
    points = [(random.uniform(48.8434100, 48.8634100),
               random.uniform(2.3388000, 2.3588000))
              for _ in range(random.randint(2, 9))]
    return jsonify({'points': points})


@app.route('/contact')
def contact():
    return render_template('contact.html', title='Contact')
[((27, 1, 27, 15), 'app.app.route', 'app.route', ({(27, 11, 27, 14): '"""/"""'}, {}), "('/')", False, 'from app import app\n'), ((32, 1, 32, 49), 'app.app.route', 'app.route', (), '', False, 'from app import app\n'), ((46, 1, 46, 20), 'app.app.route', 'app.route', ({(46, 11, 46, 19): '"""/index"""'}, {}), "('/index')", False, 'from app import app\n'), ((50, 1, 50, 18), 'app.app.route', 'app.route', ({(50, 11, 50, 17): '"""/map"""'}, {}), "('/map')", False, 'from app import app\n'), ((55, 1, 55, 44), 'app.app.route', 'app.route', (), '', False, 'from app import app\n'), ((63, 1, 63, 22), 'app.app.route', 'app.route', ({(63, 11, 63, 21): '"""/contact"""'}, {}), "('/contact')", False, 'from app import app\n'), ((29, 11, 29, 54), 'flask.render_template', 'render_template', (), '', False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((43, 10, 43, 117), 'flask.render_template', 'render_template', (), '', False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((48, 11, 48, 54), 'flask.render_template', 'render_template', (), '', False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((52, 11, 52, 51), 'flask.render_template', 'render_template', (), '', False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((60, 11, 60, 38), 'flask.jsonify', 'jsonify', ({(60, 19, 60, 37): "{'points': points}"}, {}), "({'points': points})", False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((65, 11, 65, 59), 'flask.render_template', 'render_template', (), '', False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((35, 15, 35, 38), 'flask.request.form.get', 'request.form.get', ({(35, 32, 35, 37): '"""exp"""'}, {}), "('exp')", False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((36, 15, 36, 38), 'flask.request.form.get', 'request.form.get', ({(36, 32, 36, 37): '"""job"""'}, {}), "('job')", False, 'from flask import render_template, jsonify, Flask, redirect, url_for, request\n'), ((57, 15, 57, 53), 'random.uniform', 'random.uniform', ({(57, 30, 57, 40): '(48.84341)', (57, 42, 57, 52): '(48.86341)'}, {}), '(48.84341, 48.86341)', False, 'import random\n'), ((58, 15, 58, 51), 'random.uniform', 'random.uniform', ({(58, 30, 58, 39): '(2.3388)', (58, 41, 58, 50): '(2.3588)'}, {}), '(2.3388, 2.3588)', False, 'import random\n'), ((59, 29, 59, 49), 'random.randint', 'random.randint', ({(59, 44, 59, 45): '(2)', (59, 47, 59, 48): '(9)'}, {}), '(2, 9)', False, 'import random\n')]