Ejemplo n.º 1
0
from colabcode import ColabCode
ColabCode(port=10000)
Ejemplo n.º 2
0
    except:
        address = 'Không thể nhận biết'

    try:
        timestamp = ' '.join(dict_cls[2])
    except:
        timestamp = 'Không thể nhận biết'

    try:
        totalcost = totalcost[-1]
    except:
        totalcost = 'Không thể nhận biết'

    # Trả về kết quả ra json
    dict_out = {
        "seller": seller,
        "address": address,
        "timestamp": timestamp,
        "totalcost": totalcost,
    }

    return dict_out


# run server
server = ColabCode(
    port=10001,
    code=False,
    authtoken='1tZN1OIxC54y7we1FQlNRXusGcS_4vwyHgHDwhUi9vTKsmRKc')
server.run_app(app=app)
Ejemplo n.º 3
0
    Position_Names_Vec = np.load('/content/drive/MyDrive/Colab Notebooks/Job Analysis/Position_Names_Vec.npy', allow_pickle=True)

@app.get('/')
def index():
    return {'message': 'This is the homepage of the API '}


@app.post('/predict')
def predict_job(data: Text):
    
    word_seq, word_index =preprocessData([data.text], tokenizer)
    pred=model.predict(word_seq)
    output = []
    max=0.0
    for i in range(Position_Names_Vec.shape[0]):
      cos= cosine_similarity([pred[0],Position_Names_Vec[i]])[0][1]
      output.append(cos)
      if cos > max:
        max = cos
        print(max)
    dictionary = pd.DataFrame(Position_Names, columns=['Position'])
    dictionary['Cosine'] = output
    dictionary=dictionary.sort_values(by=['Cosine'], ascending=False)
    return {'Position': dictionary.head(10)['Position'].tolist(), 'Cosine': dictionary.head(10)['Cosine'].tolist()}

from colabcode import ColabCode
server = ColabCode(port=10000, code=False)

server.run_app(app=app)

Ejemplo n.º 4
0
from colabcode import ColabCode

ColabCode()