{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import requests\n", "import json" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'inputs': [\"That's just so romantic, I guess you're really falling for her!\",\n", " 'Never have I felt so disgusted in my life.',\n", " 'The sun was shining, we had a great lunch and then took a hike - it was the greatest day of my life.',\n", " 'It came out of nowhere, noboy was expecting that.'],\n", " 'predictions': ['love', 'anger', 'joy', 'fear']}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response = requests.post(\n", " url='http://127.0.0.1:9696/predict',\n", " json={'text': \n", " [\"That's just so romantic, I guess you're really falling for her!\",\n", " \"Never have I felt so disgusted in my life.\",\n", " \"The sun was shining, we had a great lunch and then took a hike - it was the greatest day of my life.\",\n", " \"It came out of nowhere, noboy was expecting that.\"\n", " ]}\n", ")\n", "\n", "response = json.loads(response.text)\n", "response" ] } ], "metadata": { "kernelspec": { "display_name": "hugging", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }