Michelangiolo commited on
Commit
6c655b6
1 Parent(s): d8d720c
Files changed (2) hide show
  1. app.py +22 -22
  2. gpt3-gradio.ipynb +86 -76
app.py CHANGED
@@ -43,33 +43,33 @@ def greet(length, name, do, tone):
43
  # """
44
  return gpt3_endpoint(gpt3_key, prompt).replace('\n', ' ').strip()
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  # iface = gr.Interface(
47
  # fn=greet,
48
  # title='GPT3 startup pitch writer',
49
  # inputs=[
50
- # gr.Radio(["3-minute pitch", "1-minute pitch", "sentence"], label="length", value='sentence'),
51
- # gr.Text(headers=["q1"], label="What is the name of your Startup?", value="Goliath AI Consulting"),
52
- # gr.Text(headers=["q2"], label="What does your startup do?", value='Creating software powered with GPT3'),
53
  # gr.Radio(["professional", "funny", "innovative", "challenging"], label="Tone", value='innovative'),
54
- # gr.Radio(["clients", "VCs", "social media"], label="Pitch Audience", value='clients'),
55
- # gr.Text(headers=["q5"], label="What is the vision of your company?", value='Empower businesses with the power of next-gen technology')
56
  # ],
57
  # outputs='text'
58
  # )
59
- # iface.launch(share=False)
60
- #BUG, if we try to run ONLY it on local without using share=True returns blank screen, but by sharing it it also work on localhost
61
-
62
- iface = gr.Interface(
63
- fn=greet,
64
- title='GPT3 startup pitch writer',
65
- inputs=[
66
- gr.Radio(["3-minute pitch", "1-minute pitch", "sentence"], label="length", value='sentence'),
67
- gr.Text(headers=["q1"], label="What is the name of your Startup?", value='Goliath AI Consulting'),
68
- gr.Text(headers=["q2"], label="What does your startup do?", value='We build AI Recommendation Systems'),
69
- gr.Radio(["professional", "funny", "innovative", "challenging"], label="Tone", value='innovative'),
70
- # gr.Radio(["clients", "VCs", "social media"], label="Pitch Audience", value='VCs')
71
- # gr.Text(headers=["q5"], label="What is the vision of your company?", value='empowering companies with the latest AI')
72
- ],
73
- outputs='text'
74
- )
75
- iface.launch(share=False)
 
43
  # """
44
  return gpt3_endpoint(gpt3_key, prompt).replace('\n', ' ').strip()
45
 
46
+ with gr.Blocks() as demo:
47
+ gr.Markdown(
48
+ """
49
+ # GPT3 startup pitch writer
50
+ """
51
+ )
52
+ input1 = gr.Radio(["1-minute pitch", "sentence"], label="length", value='sentence')
53
+ input2 = gr.Text(headers=["q1"], label="What is the name of your Startup?", value='Goliath AI Consulting')
54
+ input3 = gr.Text(headers=["q2"], label="What does your startup do?", value='We build AI Recommendation Systems')
55
+ input4 = gr.Radio(["professional", "funny", "innovative", "challenging"], label="Tone", value='innovative')
56
+
57
+ btn = gr.Button(value="Write a Pitch!")
58
+ state = gr.Text(label="Output")
59
+ btn.click(greet, [input1, input2, input3, input4], [state])
60
+ demo.launch(share=False)
61
+
62
  # iface = gr.Interface(
63
  # fn=greet,
64
  # title='GPT3 startup pitch writer',
65
  # inputs=[
66
+ # gr.Radio(["1-minute pitch", "sentence"], label="length", value='sentence'),
67
+ # gr.Text(headers=["q1"], label="What is the name of your Startup?", value='Goliath AI Consulting'),
68
+ # gr.Text(headers=["q2"], label="What does your startup do?", value='We build AI Recommendation Systems'),
69
  # gr.Radio(["professional", "funny", "innovative", "challenging"], label="Tone", value='innovative'),
70
+ # # gr.Radio(["clients", "VCs", "social media"], label="Pitch Audience", value='VCs')
71
+ # # gr.Text(headers=["q5"], label="What is the vision of your company?", value='empowering companies with the latest AI')
72
  # ],
73
  # outputs='text'
74
  # )
75
+ # iface.launch(share=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gpt3-gradio.ipynb CHANGED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 31,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
@@ -30,47 +30,75 @@
30
  },
31
  {
32
  "cell_type": "code",
33
- "execution_count": 21,
34
  "metadata": {},
35
- "outputs": [
36
- {
37
- "data": {
38
- "text/plain": [
39
- "'\\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.'"
40
- ]
41
- },
42
- "execution_count": 21,
43
- "metadata": {},
44
- "output_type": "execute_result"
45
- },
46
- {
47
- "name": "stdout",
48
- "output_type": "stream",
49
- "text": [
50
- "\n",
51
- " Write a one minute pitch with innovative tone for a startup with the following info:\n",
52
- " what does the startup do? Creating software powered with GPT3\n",
53
- " industry: AI\n",
54
- " audience of the pitch: clients\n",
55
- " vision of the startup: Empower businesses with the power of next-gen technology\n",
56
- " \n"
57
- ]
58
- }
59
- ],
60
  "source": [
61
- "prompt = \"\"\"\n",
62
- "Write a one minute pitch with innovative tone for a startup with the following info:\n",
63
- "what does the startup do? Creating software powered with GPT3\n",
64
- "industry: AI\n",
65
- "audience of the pitch: clients\n",
66
- "vision of the startup: Empower businesses with the power of next-gen technology\n",
67
- "\"\"\"\n",
68
- "gpt3_endpoint(prompt)"
69
  ]
70
  },
71
  {
72
  "cell_type": "code",
73
- "execution_count": 36,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  "metadata": {},
75
  "outputs": [
76
  {
@@ -80,8 +108,6 @@
80
  "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",
81
  " warnings.warn(\n",
82
  "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",
83
- " warnings.warn(\n",
84
- "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",
85
  " warnings.warn(\n"
86
  ]
87
  },
@@ -89,7 +115,7 @@
89
  "name": "stdout",
90
  "output_type": "stream",
91
  "text": [
92
- "Running on local URL: http://127.0.0.1:7888\n",
93
  "\n",
94
  "To create a public link, set `share=True` in `launch()`.\n"
95
  ]
@@ -97,7 +123,7 @@
97
  {
98
  "data": {
99
  "text/html": [
100
- "<div><iframe src=\"http://127.0.0.1:7888/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
101
  ],
102
  "text/plain": [
103
  "<IPython.core.display.HTML object>"
@@ -110,7 +136,7 @@
110
  "data": {
111
  "text/plain": []
112
  },
113
- "execution_count": 36,
114
  "metadata": {},
115
  "output_type": "execute_result"
116
  }
@@ -118,48 +144,32 @@
118
  "source": [
119
  "import gradio as gr\n",
120
  "\n",
121
- "#the first module becomes text1, the second module file1\n",
122
- "def greet(length, name, do, tone, audience, vision): \n",
123
  " prompt = f\"\"\"\n",
124
  " Write a {length} with {tone} tone for a startup with the following info:\n",
125
  " The name of the startup: {name}\n",
126
  " what does the startup do? {do}\n",
127
- " audience of the pitch: {audience}\n",
128
- " vision of the startup: {vision}\n",
129
  " \"\"\"\n",
 
 
 
130
  " return gpt3_endpoint(prompt).replace('\\n', ' ').strip()\n",
131
  "\n",
132
- "# iface = gr.Interface(\n",
133
- "# fn=greet,\n",
134
- "# title='GPT3 startup pitch writer',\n",
135
- "# inputs=[\n",
136
- "# gr.Radio([\"3-minute pitch\", \"1-minute pitch\", \"sentence\"], label=\"length\", value='sentence'),\n",
137
- "# gr.Text(headers=[\"q1\"], label=\"What is the name of your Startup?\", value=\"Goliath AI Consulting\"),\n",
138
- "# gr.Text(headers=[\"q2\"], label=\"What does your startup do?\", value='Creating software powered with GPT3'),\n",
139
- "# gr.Radio([\"professional\", \"funny\", \"innovative\", \"challenging\"], label=\"Tone\", value='innovative'),\n",
140
- "# gr.Radio([\"clients\", \"VCs\", \"social media\"], label=\"Pitch Audience\", value='clients'),\n",
141
- "# gr.Text(headers=[\"q5\"], label=\"What is the vision of your company?\", value='Empower businesses with the power of next-gen technology')\n",
142
- "# ],\n",
143
- "# outputs='text'\n",
144
- "# )\n",
145
- "# iface.launch(share=False)\n",
146
- "#BUG, if we try to run ONLY it on local without using share=True returns blank screen, but by sharing it it also work on localhost\n",
147
- "\n",
148
- "\n",
149
- "iface = gr.Interface(\n",
150
- " fn=greet,\n",
151
- " title='GPT3 startup pitch writer',\n",
152
- " inputs=[\n",
153
- " gr.Radio([\"3-minute pitch\", \"1-minute pitch\", \"sentence\"], label=\"length\"),\n",
154
- " gr.Text(headers=[\"q1\"], label=\"What is the name of your Startup?\"),\n",
155
- " gr.Text(headers=[\"q2\"], label=\"What does your startup do?\"),\n",
156
- " gr.Radio([\"professional\", \"funny\", \"innovative\", \"challenging\"], label=\"Tone\"),\n",
157
- " gr.Radio([\"clients\", \"VCs\", \"social media\"], label=\"Pitch Audience\"),\n",
158
- " gr.Text(headers=[\"q5\"], label=\"What is the vision of your company?\")\n",
159
- " ],\n",
160
- " outputs='text'\n",
161
- ")\n",
162
- "iface.launch(share=False)"
163
  ]
164
  }
165
  ],
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 3,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
 
30
  },
31
  {
32
  "cell_type": "code",
33
+ "execution_count": 4,
34
  "metadata": {},
35
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  "source": [
37
+ "# prompt = \"\"\"\n",
38
+ "# Write a one minute pitch with innovative tone for a startup with the following info:\n",
39
+ "# what does the startup do? Creating software powered with GPT3\n",
40
+ "# industry: AI\n",
41
+ "# audience of the pitch: clients\n",
42
+ "# vision of the startup: Empower businesses with the power of next-gen technology\n",
43
+ "# \"\"\"\n",
44
+ "# gpt3_endpoint(prompt)"
45
  ]
46
  },
47
  {
48
  "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": [
53
+ "import gradio as gr\n",
54
+ "\n",
55
+ "#the first module becomes text1, the second module file1\n",
56
+ "def greet(length, name, do, tone, audience, vision): \n",
57
+ " prompt = f\"\"\"\n",
58
+ " Write a {length} with {tone} tone for a startup with the following info:\n",
59
+ " The name of the startup: {name}\n",
60
+ " what does the startup do? {do}\n",
61
+ " audience of the pitch: {audience}\n",
62
+ " vision of the startup: {vision}\n",
63
+ " \"\"\"\n",
64
+ " return gpt3_endpoint(prompt).replace('\\n', ' ').strip()\n",
65
+ "\n",
66
+ "# iface = gr.Interface(\n",
67
+ "# fn=greet,\n",
68
+ "# title='GPT3 startup pitch writer',\n",
69
+ "# inputs=[\n",
70
+ "# gr.Radio([\"3-minute pitch\", \"1-minute pitch\", \"sentence\"], label=\"length\", value='sentence'),\n",
71
+ "# gr.Text(headers=[\"q1\"], label=\"What is the name of your Startup?\", value=\"Goliath AI Consulting\"),\n",
72
+ "# gr.Text(headers=[\"q2\"], label=\"What does your startup do?\", value='Creating software powered with GPT3'),\n",
73
+ "# gr.Radio([\"professional\", \"funny\", \"innovative\", \"challenging\"], label=\"Tone\", value='innovative'),\n",
74
+ "# gr.Radio([\"clients\", \"VCs\", \"social media\"], label=\"Pitch Audience\", value='clients'),\n",
75
+ "# gr.Text(headers=[\"q5\"], label=\"What is the vision of your company?\", value='Empower businesses with the power of next-gen technology')\n",
76
+ "# ],\n",
77
+ "# outputs='text'\n",
78
+ "# )\n",
79
+ "# iface.launch(share=False)\n",
80
+ "#BUG, if we try to run ONLY it on local without using share=True returns blank screen, but by sharing it it also work on localhost\n",
81
+ "\n",
82
+ "\n",
83
+ "iface = gr.Interface(\n",
84
+ " fn=greet,\n",
85
+ " title='GPT3 startup pitch writer',\n",
86
+ " inputs=[\n",
87
+ " gr.Radio([\"3-minute pitch\", \"1-minute pitch\", \"sentence\"], label=\"length\"),\n",
88
+ " gr.Text(headers=[\"q1\"], label=\"What is the name of your Startup?\"),\n",
89
+ " gr.Text(headers=[\"q2\"], label=\"What does your startup do?\"),\n",
90
+ " gr.Radio([\"professional\", \"funny\", \"innovative\", \"challenging\"], label=\"Tone\"),\n",
91
+ " gr.Radio([\"clients\", \"VCs\", \"social media\"], label=\"Pitch Audience\"),\n",
92
+ " gr.Text(headers=[\"q5\"], label=\"What is the vision of your company?\")\n",
93
+ " ],\n",
94
+ " outputs='text'\n",
95
+ ")\n",
96
+ "iface.launch(share=False)"
97
+ ]
98
+ },
99
+ {
100
+ "cell_type": "code",
101
+ "execution_count": 18,
102
  "metadata": {},
103
  "outputs": [
104
  {
 
108
  "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",
109
  " warnings.warn(\n",
110
  "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",
 
 
111
  " warnings.warn(\n"
112
  ]
113
  },
 
115
  "name": "stdout",
116
  "output_type": "stream",
117
  "text": [
118
+ "Running on local URL: http://127.0.0.1:7867\n",
119
  "\n",
120
  "To create a public link, set `share=True` in `launch()`.\n"
121
  ]
 
123
  {
124
  "data": {
125
  "text/html": [
126
+ "<div><iframe src=\"http://127.0.0.1:7867/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
127
  ],
128
  "text/plain": [
129
  "<IPython.core.display.HTML object>"
 
136
  "data": {
137
  "text/plain": []
138
  },
139
+ "execution_count": 18,
140
  "metadata": {},
141
  "output_type": "execute_result"
142
  }
 
144
  "source": [
145
  "import gradio as gr\n",
146
  "\n",
147
+ "def greet(length, name, do, tone): \n",
 
148
  " prompt = f\"\"\"\n",
149
  " Write a {length} with {tone} tone for a startup with the following info:\n",
150
  " The name of the startup: {name}\n",
151
  " what does the startup do? {do}\n",
 
 
152
  " \"\"\"\n",
153
+ " # audience of the pitch: {audience}\n",
154
+ " # vision of the startup: {vision}\n",
155
+ " # \"\"\"\n",
156
  " return gpt3_endpoint(prompt).replace('\\n', ' ').strip()\n",
157
  "\n",
158
+ "with gr.Blocks() as demo:\n",
159
+ " gr.Markdown(\n",
160
+ " \"\"\"\n",
161
+ " # GPT3 startup pitch writer\n",
162
+ " \"\"\"\n",
163
+ " )\n",
164
+ " input1 = gr.Radio([\"1-minute pitch\", \"sentence\"], label=\"length\", value='sentence')\n",
165
+ " input2 = gr.Text(headers=[\"q1\"], label=\"What is the name of your Startup?\", value='Goliath AI Consulting')\n",
166
+ " input3 = gr.Text(headers=[\"q2\"], label=\"What does your startup do?\", value='We build AI Recommendation Systems')\n",
167
+ " input4 = gr.Radio([\"professional\", \"funny\", \"innovative\", \"challenging\"], label=\"Tone\", value='innovative')\n",
168
+ " \n",
169
+ " btn = gr.Button(value=\"Write a Pitch!\")\n",
170
+ " state = gr.Text(label=\"Output\")\n",
171
+ " btn.click(greet, [input1, input2, input3, input4], [state])\n",
172
+ "demo.launch(share=False)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  ]
174
  }
175
  ],