File size: 21,348 Bytes
d97b57a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from gpt3_function import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "import numpy as np\n",
    "\n",
    "def generate_weighted_list(weighted_list, length, verbose=False):\n",
    "    if verbose : print(weighted_list)\n",
    "    items = [*weighted_list.keys()]\n",
    "    weights = [*weighted_list.values()]\n",
    "    weights = np.array(weights)\n",
    "    output = list(np.random.choice(items, length, p=weights/sum(weights)))\n",
    "    return output\n",
    "\n",
    "#simple\n",
    "def kapuhala_list(weighted_list, length):\n",
    "\n",
    "    def generate_weighted_list(weighted_list, length, verbose=False):\n",
    "        if verbose : print(weighted_list)\n",
    "        items = [*weighted_list.keys()]\n",
    "        weights = [*weighted_list.values()]\n",
    "        weights = np.array(weights)\n",
    "        output = list(np.random.choice(items, length, p=weights/sum(weights)))\n",
    "        return output\n",
    "\n",
    "    list1 = list()\n",
    "    for index in range(0, length):\n",
    "        weighted_list_ = weighted_list.copy()\n",
    "        if index == 1:\n",
    "            #look 1 position back \n",
    "            del weighted_list_[list1[index-1][0]]\n",
    "            list1.append(generate_weighted_list(weighted_list_, 1))\n",
    "        elif index >= 2:\n",
    "            #look 2 positions back\n",
    "            del weighted_list_[list1[index-2][0]]\n",
    "            del weighted_list_[list1[index-1][0]]\n",
    "            list1.append(generate_weighted_list(weighted_list_, 1))\n",
    "        else:\n",
    "            #we cannot look back otherwise throws error\n",
    "            list1.append(generate_weighted_list(weighted_list_, 1))\n",
    "\n",
    "    list1 = [x[0] for x in list1] \n",
    "    return list1\n",
    "\n",
    "#includes weekdays\n",
    "def kapuhala_list(weighted_list, weekday_list, length):\n",
    "\n",
    "    def generate_weighted_list(weighted_list, length, verbose=False):\n",
    "        if verbose : print(weighted_list)\n",
    "        items = [*weighted_list.keys()]\n",
    "        weights = [*weighted_list.values()]\n",
    "        weights = np.array(weights)\n",
    "        output = list(np.random.choice(items, length, p=weights/sum(weights)))\n",
    "        return output\n",
    "\n",
    "    list1 = list()\n",
    "    for index in range(0, length):\n",
    "        weighted_list_ = weighted_list.copy()\n",
    "        #weekday sequence\n",
    "        current = weekday_list[index] \n",
    "        if (current == 'Saturday') or (current == 'Sunday'):\n",
    "            del weighted_list_['weekend']\n",
    "        #avoid repetitions\n",
    "        if index == 1:\n",
    "            #look 1 position back \n",
    "            try:\n",
    "                del weighted_list_[list1[index-1][0]]\n",
    "            except:\n",
    "                pass\n",
    "            list1.append(generate_weighted_list(weighted_list_, 1))\n",
    "        elif index >= 2:\n",
    "            #look 2 positions back\n",
    "            try:\n",
    "                del weighted_list_[list1[index-12][0]]\n",
    "            except:\n",
    "                pass\n",
    "            try:\n",
    "                del weighted_list_[list1[index-1][0]]\n",
    "            except:\n",
    "                pass\n",
    "            list1.append(generate_weighted_list(weighted_list_, 1))\n",
    "        else:\n",
    "            #we cannot look back otherwise throws error\n",
    "            list1.append(generate_weighted_list(weighted_list_, 1))\n",
    "\n",
    "    list1 = [x[0] for x in list1] \n",
    "    return list1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\ardit\\AppData\\Local\\Temp\\ipykernel_21100\\3657193565.py:78: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_['prompt'] = df_['vertical'].apply(lambda x : prompt+dict1[x])\n",
      "C:\\Users\\ardit\\AppData\\Local\\Temp\\ipykernel_21100\\3657193565.py:82: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_['post'] = df_['prompt'].apply(lambda x : gpt3(x, model='gpt-3.5-turbo', service='azure'))\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>weekday</th>\n",
       "      <th>vertical</th>\n",
       "      <th>post</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-11-01</td>\n",
       "      <td>Wednesday</td>\n",
       "      <td>happyHour</td>\n",
       "      <td>🍹🍹 It's time to unwind and enjoy happy hour at...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-11-02</td>\n",
       "      <td>Thursday</td>\n",
       "      <td>wedding</td>\n",
       "      <td>👰💍🌴 Get ready to say \"I do\" or fall even more ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        date    weekday   vertical  \\\n",
       "0 2023-11-01  Wednesday  happyHour   \n",
       "1 2023-11-02   Thursday    wedding   \n",
       "\n",
       "                                                post  \n",
       "0  🍹🍹 It's time to unwind and enjoy happy hour at...  \n",
       "1  👰💍🌴 Get ready to say \"I do\" or fall even more ...  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "def generate_content(month, max_days):\n",
    "\n",
    "    weighted_list = {\n",
    "        'yogaClasses' : 4,\n",
    "        'swim' : 4,\n",
    "        'mixology' : 4,\n",
    "        'happyHour' : 6,\n",
    "        'weekend' : 0,\n",
    "        'wedding' : 2,\n",
    "        'tentedVilla' : 2,\n",
    "        'farmhouse' : 2,\n",
    "        'retreats' : 2\n",
    "    }\n",
    "\n",
    "    dates = pd.date_range(start=f'2023-{month}-01', end=f'2023-{month}-30')\n",
    "    df = pd.DataFrame({'date': dates, 'weekday': dates.strftime('%A')})\n",
    "    df['vertical'] = kapuhala_list(weighted_list, df['weekday'].values.tolist(), len(df))\n",
    "    #add weekend topic on fridays\n",
    "    df.loc[df[df['weekday']=='Friday'].index.tolist(), 'vertical'] = 'weekend'\n",
    "    df\n",
    "\n",
    "    df_ = df[0:max_days]\n",
    "    df_\n",
    "\n",
    "    dict1 = {\n",
    "        'yogaClasses' : \"\"\"\n",
    "        Find your inner zen and boost your fitness routine with our invigorating yoga and fitness classes at Kapuhala Koh Samui Surrounded by stunning nature, enjoy our incredible dishes and take advantage of our very instagrammable infinity pool. The ultimate wellness experience awaits you!\n",
    "        \"\"\",\n",
    "        'swim' : \"\"\"\n",
    "        At Halapua Restaurant we offer a Mediterranean-inspired menu using fresh seasonal ingredients and vegetables.\n",
    "        With your lunch reservation you can enjoy our infinity pool with breath taking views, it’s the perfect way to spend a half day on this tropical island! Open everyday except Mondays.\n",
    "        \"\"\",\n",
    "        'mixology' : \"\"\"\n",
    "        Halapua restaurant and mixology lounge is the only unapologetically plant-based high-end dining experience on the island. We maintain strict standards and staff training to grant you the best experience! Book your table today!\n",
    "        \"\"\",\n",
    "        'happyHour' : \"\"\"\n",
    "        Come for the happy hour at Kapuhala Koh Samui from 3pm to 6pm.\n",
    "        By getting 2 drinks you will receive a complimentary plate of snack from our kitchen! \n",
    "        \"\"\",\n",
    "        'weekend' : \"\"\"\n",
    "        Pass your Weekend with us at Kapuhala Koh Samui! \n",
    "        Book a table on the best plant based restaurant on the island.\n",
    "        Sicilian inspired cuisine made with local ingredients.\n",
    "        \"\"\",\n",
    "        'wedding' : \"\"\"\n",
    "        Wedding reception or honeymoon at Kapuhala.\n",
    "        Our gorgeous, secluded spot offers everything you need for an unforgettable, intimate event.\n",
    "        Our experienced team is here to help you create your dream event. Whether it’s a small gathering of friends or an extravagant celebration, we’ll make sure that your special day is just as perfect as you imagined.\n",
    "        Experience the paradise of Kapuhala! Plan your dream wedding or honeymoon here and let us make it all happen\n",
    "        \"\"\",\n",
    "        'tentedVilla' : \"\"\"\n",
    "        Book our TENTED VILLA at Kapuhala Koh Samui - Live Without Walls!\n",
    "        Sleeps 2 adults (Max with 1-2 more kids)\n",
    "        At Kapuhala Koh Samui you have a unique opportunity to sleep surrounded by the ambient sounds of the jungle, yet still enjoy the comforts and amenities of a hotel room. We invite you to experience a different, more natural way of living.\n",
    "        Become one with your surroundings, connect to the natural world around you and experience something as simple as waking up or taking a shower in an entirely new way.\n",
    "        All our Tented Villas are fully detached en suite structures with a private terrace where you can greet the sunrise or enjoy your breakfast. The villas are modular and with removable panels enabling you to enjoy the spectacular nature around you.\n",
    "        \"\"\",\n",
    "        'farmhouse' : \"\"\"\n",
    "        Kapuhala Koh Samui - Farmhouse\n",
    "        Nestled on the edge of a hill, these no ordinary, architecturally unique Farmhouses are fully detached rooms with separate entrances built on top of large rocks – a natural geological wonder of the area.\n",
    "        Conveniently positioned close to the main building just across our tropical farm. Each house is 27 sq. m. and sleeps 2 people in a queen-size bed. Perfect for a single person or couple.\n",
    "        Wake up daily to a serene sea view of the bay and enjoy the breath taking sunrises on your private balcony.\n",
    "        \"\"\",\n",
    "        'retreats' : \"\"\"\n",
    "        Are you ready to take your mental and physical capabilities to the next level?\n",
    "        Yoga, Fitness and Nutrition!\n",
    "        Come join us at Kapuhala for an exclusive Superhuman retreat and experience the power of true, natural Biohacking.\n",
    "        At Kapuhala Koh Samui you will be sharing your day with Stefano Passarello, Crystal Lee and other entrepreneurial minds and forward thinkers just like you.\n",
    "        Through our 5 day protocol you'll be able to maximize your mental performance, increase creativity, and optimize physical performance.\n",
    "        What are you waiting for? Join us at Kapuhala and unlock your superhuman capabilities!\n",
    "        We can also help you organize a tailor made retreat on the dates that best suit your needs.\n",
    "        \"\"\"\n",
    "    }\n",
    "\n",
    "    prompt = 'Write a social media post-caption about this: add emoji, add hashtags at the end :'\n",
    "    df_['prompt'] = df_['vertical'].apply(lambda x : prompt+dict1[x])\n",
    "    # df_ = df_[0:3]\n",
    "\n",
    "    \n",
    "    df_['post'] = df_['prompt'].apply(lambda x : gpt3(x, model='gpt-3.5-turbo', service='azure'))\n",
    "    # df_['post'] = df_['prompt'].apply(lambda x : 'mmm')\n",
    "    return df_.drop('prompt', axis=1)\n",
    "\n",
    "df_content = generate_content(11, 2)\n",
    "df_content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<function __main__.generate_content(month, max_days)>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "generate_content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "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 Radio, please remove them: {'multiselect': False}\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Running on local URL:  http://127.0.0.1:7865\n",
      "\n",
      "To create a public link, set `share=True` in `launch()`.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><iframe src=\"http://127.0.0.1:7865/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": []
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\ardit\\AppData\\Local\\Temp\\ipykernel_21100\\3657193565.py:78: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_['prompt'] = df_['vertical'].apply(lambda x : prompt+dict1[x])\n",
      "C:\\Users\\ardit\\AppData\\Local\\Temp\\ipykernel_21100\\3657193565.py:82: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_['post'] = df_['prompt'].apply(lambda x : gpt3(x, model='gpt-3.5-turbo', service='azure'))\n"
     ]
    }
   ],
   "source": [
    "import gradio as gr\n",
    "\n",
    "with gr.Blocks(theme=gr.themes.Soft(primary_hue='amber', secondary_hue='gray', neutral_hue='amber')) as demo:\n",
    "    gr.Markdown(\n",
    "    \"\"\"\n",
    "    # Content Calendar Generator\n",
    "    \"\"\"\n",
    "    )\n",
    "    # input1 = gr.Slider(1, 31, value=5, step_size=10, label=\"# Days\")\n",
    "    input1 = gr.Slider(1, 12, step=1, value=5, label=\"Month\")\n",
    "    input2 = gr.Radio([1, 3, 5, 10, 30], multiselect=False, label='# Days', value=3)\n",
    "    # input3 = gr.Radio(['Manhattan', 'Brooklyn', 'Queens', 'Bronx'], multiselect=False, label='State', value='Brooklyn')\n",
    "    # input4 = gr.Textbox(label='Query', value='I want to take a break from work 😴!!!')\n",
    "\n",
    "    btn = gr.Button(value=\"Generate Content\")\n",
    "    output1 = gr.Dataframe()\n",
    "    # btn.click(greet, inputs='text', outputs=['dataframe'])\n",
    "    btn.click(generate_content, [input1, input2], [output1])\n",
    "demo.launch(share=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "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 Radio, please remove them: {'multiselect': False}\n",
      "  warnings.warn(\n",
      "c:\\Users\\ardit\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\\utils.py:951: UserWarning: Expected 0 arguments for function <function foo at 0x0000022D98619EE0>, received 1.\n",
      "  warnings.warn(\n",
      "c:\\Users\\ardit\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\\utils.py:959: UserWarning: Expected maximum 0 arguments for function <function foo at 0x0000022D98619EE0>, received 1.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Running on local URL:  http://127.0.0.1:7861\n",
      "\n",
      "To create a public link, set `share=True` in `launch()`.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><iframe src=\"http://127.0.0.1:7861/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": []
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\ardit\\AppData\\Local\\Temp\\ipykernel_21100\\1929261880.py:58: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_['prompt'] = df_['vertical'].apply(lambda x : prompt+dict1[x])\n",
      "C:\\Users\\ardit\\AppData\\Local\\Temp\\ipykernel_21100\\1929261880.py:62: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_['post'] = df_['prompt'].apply(lambda x : gpt3(x, model='gpt-3.5-turbo', service='azure'))\n"
     ]
    }
   ],
   "source": [
    "import gradio as gr\n",
    "\n",
    "def foo():\n",
    "    return 0\n",
    "\n",
    "with gr.Blocks(theme=gr.themes.Soft(primary_hue='amber', secondary_hue='gray', neutral_hue='amber')) as demo:\n",
    "    gr.Markdown(\n",
    "    \"\"\"\n",
    "    # Message generator\n",
    "    \"\"\"\n",
    "    )\n",
    "    input1 = gr.Textbox(label='Input data', placeholder='Insert data from Linkedin here')\n",
    "    input2 = gr.Radio(['Phishing', 'Sale', 'Feedback'], multiselect=False, label='Type of message')\n",
    "    input3 = gr.Radio(['Linkedin', 'Instagram', 'Website'], multiselect=False, label='Source of information')\n",
    "    # input3 = gr.Radio(['Manhattan', 'Brooklyn', 'Queens', 'Bronx'], multiselect=False, label='State', value='Brooklyn')\n",
    "    # input4 = gr.Textbox(label='Query', value='I want to take a break from work 😴!!!')\n",
    "\n",
    "    btn = gr.Button(value=\"Generate Message\")\n",
    "    output1 = gr.Textbox()\n",
    "    # btn.click(greet, inputs='text', outputs=['dataframe'])\n",
    "    btn.click(foo, [input1], [output1])\n",
    "demo.launch(share=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.13"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}