" return jsonify(success=\"Pre-trained model loaded successfully\")\n",
" except Exception as e:\n",
" return jsonify(error=str(e)), 500"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3358edd7-ced6-4a2e-b838-ac354c9c0809",
"metadata": {},
"outputs": [],
"source": [
"@app.route('/predict', methods=['POST'])\n",
"## Train must be run before this\n",
"## run from command line with: curl -s -H \"Content-Type: application/json\" -X POST -d '{\"input\": }' localhost:8080/predict\n",
"## examples:\n",
"## curl -s -H \"Content-Type: application/json\" -X POST -d '{\"input\": \"For this purpose the Gothenburg Young Persons Empowerment Scale (GYPES) was developed.\"}' localhost:8080/predict\n",
"## curl -s -H \"Content-Type: application/json\" -X POST -d '{\"input\": \"Recent work by us and others suggest that the host’s heat shock protein 90 (Hsp90) chaperone can modulate the evolutionary paths traversed by viruses [18, 19].\"}' localhost:8080/predict\n",
## run from command line with: curl -s -H "Content-Type: application/json" -X POST -d '{"input": }' localhost:8080/predict
## examples:
## curl -s -H "Content-Type: application/json" -X POST -d '{"input": "For this purpose the Gothenburg Young Persons Empowerment Scale (GYPES) was developed."}' localhost:8080/predict
## curl -s -H "Content-Type: application/json" -X POST -d '{"input": "Recent work by us and others suggest that the host’s heat shock protein 90 (Hsp90) chaperone can modulate the evolutionary paths traversed by viruses [18, 19]."}' localhost:8080/predict