{ "cells": [ { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [], "source": [ "import requests\n", "\n", "def gpt3_endpoint(prompt):\n", " api_endpoint = \"https://api.openai.com/v1/engines/text-davinci-003/completions\"\n", " api_key = \"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\"\n", "\n", " headers = {\n", " \"Content-Type\": \"application/json\",\n", " \"Authorization\": f\"Bearer {api_key}\"\n", " }\n", "\n", " data = {\n", " \"prompt\": prompt,\n", " \"max_tokens\": 200,\n", " \"temperature\": 0.8\n", " }\n", "\n", " response = requests.post(api_endpoint, headers=headers, json=data)\n", " generated_text = response.json()[\"choices\"][0][\"text\"]\n", " return generated_text" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'\\nAre you ready to take your business to the next level? Our startup is here to help you do just that with our revolutionary software powered with GPT3. We are revolutionizing the AI industry by empowering businesses with the power of next-gen technology. Our software uses GPT3 to generate natural language processing and generate insights that can be used to improve your business in ways you never thought possible. We are here to help you unlock the power of AI and take your business to the next level.'" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" }, { "name": "stdout", "output_type": "stream", "text": [ "\n", " Write a one minute pitch with innovative tone for a startup with the following info:\n", " what does the startup do? Creating software powered with GPT3\n", " industry: AI\n", " audience of the pitch: clients\n", " vision of the startup: Empower businesses with the power of next-gen technology\n", " \n" ] } ], "source": [ "prompt = \"\"\"\n", "Write a one minute pitch with innovative tone for a startup with the following info:\n", "what does the startup do? Creating software powered with GPT3\n", "industry: AI\n", "audience of the pitch: clients\n", "vision of the startup: Empower businesses with the power of next-gen technology\n", "\"\"\"\n", "gpt3_endpoint(prompt)" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\ardit\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\\deprecation.py:43: UserWarning: You have unused kwarg parameters in Textbox, please remove them: {'headers': ['q1']}\n", " warnings.warn(\n", "c:\\Users\\ardit\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\\deprecation.py:43: UserWarning: You have unused kwarg parameters in Textbox, please remove them: {'headers': ['q2']}\n", " warnings.warn(\n", "c:\\Users\\ardit\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\\deprecation.py:43: UserWarning: You have unused kwarg parameters in Textbox, please remove them: {'headers': ['q5']}\n", " warnings.warn(\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7888\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "