Eric Michael Martinez commited on
Commit
7515e7a
1 Parent(s): 1d93ada
Files changed (2) hide show
  1. app/app.py +40 -0
  2. student_api.ipynb +300 -21
app/app.py CHANGED
@@ -90,6 +90,36 @@ def get_ai_reply(message, model="gpt-3.5-turbo", system_message=None, temperatur
90
  # Extract and return the AI's response from the API response
91
  return completion.choices[0].message.content.strip()
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  # Define a function to handle the chat interaction with the AI model
94
  def chat(model, system_message, message, chatbot_messages, history_state):
95
  # Initialize chatbot_messages and history_state if they are not provided
@@ -162,6 +192,16 @@ def get_chatbot_app(additional_examples=[]):
162
  example_load_btn.click(choose_example, inputs=[example_dropdown], outputs=[system_message, message, chatbot, history_state])
163
  # Connect the send button to the chat function
164
  btn.click(chat, inputs=[model_selector, system_message, message, chatbot, history_state], outputs=[message, chatbot, history_state])
 
 
 
 
 
 
 
 
 
 
165
  with gr.Tab("Get API Key"):
166
  email_box = gr.Textbox(label="Email Address", placeholder="Student Email")
167
  password_box = gr.Textbox(label="Password", type="password", placeholder="Student ID")
 
90
  # Extract and return the AI's response from the API response
91
  return completion.choices[0].message.content.strip()
92
 
93
+ def get_ai_image(prompt, size="512x512"):
94
+ response = openai.Image.create(
95
+ prompt=prompt,
96
+ n=1,
97
+ size=size
98
+ )
99
+ image_1_url = response.data[0]['url']
100
+ return image_1_url
101
+
102
+ def get_ai_transcript(path_to_audio, language=None):
103
+ audio_file= open(path_to_audio, "rb")
104
+ transcript = openai.Audio.transcribe("whisper-1", audio_file, language=language)
105
+ return transcript.text
106
+
107
+ def generate_transcription(path_to_audio_file):
108
+ try:
109
+ transcript = get_ai_transcript(path_to_audio_file)
110
+ return transcript
111
+ except Exception as e:
112
+ raise gr.Error(e)
113
+ return ""
114
+
115
+ def generate_image(prompt):
116
+ try:
117
+ image_url = get_ai_image(prompt)
118
+ return image_url
119
+ except Exception as e:
120
+ raise gr.Error(e)
121
+ return None
122
+
123
  # Define a function to handle the chat interaction with the AI model
124
  def chat(model, system_message, message, chatbot_messages, history_state):
125
  # Initialize chatbot_messages and history_state if they are not provided
 
192
  example_load_btn.click(choose_example, inputs=[example_dropdown], outputs=[system_message, message, chatbot, history_state])
193
  # Connect the send button to the chat function
194
  btn.click(chat, inputs=[model_selector, system_message, message, chatbot, history_state], outputs=[message, chatbot, history_state])
195
+ with gr.Tab("Image Generation"):
196
+ image_prompt = gr.Textbox(label="Prompt", placeholder="A cute puppy wearing sunglasses.")
197
+ image_btn = gr.Button(value="Generate")
198
+ image = gr.Image(label="Result", interactive=False, type="filepath")
199
+ image_btn.click(generate_image, inputs=[image_prompt], outputs=[image])
200
+ with gr.Tab("Speech-to-text"):
201
+ audio_file = gr.Audio(label="Audio", source="microphone", type="filepath")
202
+ transcribe = gr.Button(value="Transcribe")
203
+ audio_transcript = gr.Textbox(label="Transcription", interactive=False)
204
+ transcribe.click(generate_transcription, inputs=[audio_file], outputs=[audio_transcript])
205
  with gr.Tab("Get API Key"):
206
  email_box = gr.Textbox(label="Email Address", placeholder="Student Email")
207
  password_box = gr.Textbox(label="Password", type="password", placeholder="Student ID")
student_api.ipynb CHANGED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": null,
6
  "id": "4fca2e60",
7
  "metadata": {},
8
  "outputs": [],
@@ -12,10 +12,18 @@
12
  },
13
  {
14
  "cell_type": "code",
15
- "execution_count": null,
16
  "id": "a4ffa93a",
17
  "metadata": {},
18
- "outputs": [],
 
 
 
 
 
 
 
 
19
  "source": [
20
  "%%writefile app/db.py\n",
21
  "from typing import AsyncGenerator\n",
@@ -71,10 +79,18 @@
71
  },
72
  {
73
  "cell_type": "code",
74
- "execution_count": null,
75
  "id": "d2a08335",
76
  "metadata": {},
77
- "outputs": [],
 
 
 
 
 
 
 
 
78
  "source": [
79
  "%%writefile app/schemas.py\n",
80
  "import uuid\n",
@@ -96,10 +112,18 @@
96
  },
97
  {
98
  "cell_type": "code",
99
- "execution_count": null,
100
  "id": "9d649fcc",
101
  "metadata": {},
102
- "outputs": [],
 
 
 
 
 
 
 
 
103
  "source": [
104
  "%%writefile app/users.py\n",
105
  "import uuid\n",
@@ -174,10 +198,18 @@
174
  },
175
  {
176
  "cell_type": "code",
177
- "execution_count": null,
178
  "id": "d2250413",
179
  "metadata": {},
180
- "outputs": [],
 
 
 
 
 
 
 
 
181
  "source": [
182
  "%%writefile app/app.py\n",
183
  "import httpx\n",
@@ -272,6 +304,36 @@
272
  " # Extract and return the AI's response from the API response\n",
273
  " return completion.choices[0].message.content.strip()\n",
274
  "\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  "# Define a function to handle the chat interaction with the AI model\n",
276
  "def chat(model, system_message, message, chatbot_messages, history_state):\n",
277
  " # Initialize chatbot_messages and history_state if they are not provided\n",
@@ -344,6 +406,16 @@
344
  " example_load_btn.click(choose_example, inputs=[example_dropdown], outputs=[system_message, message, chatbot, history_state])\n",
345
  " # Connect the send button to the chat function\n",
346
  " btn.click(chat, inputs=[model_selector, system_message, message, chatbot, history_state], outputs=[message, chatbot, history_state])\n",
 
 
 
 
 
 
 
 
 
 
347
  " with gr.Tab(\"Get API Key\"):\n",
348
  " email_box = gr.Textbox(label=\"Email Address\", placeholder=\"Student Email\")\n",
349
  " password_box = gr.Textbox(label=\"Password\", type=\"password\", placeholder=\"Student ID\")\n",
@@ -412,32 +484,49 @@
412
  " \n",
413
  "gradio_gui = get_chatbot_app()\n",
414
  "gradio_gui.auth = api_login\n",
415
- "gradio_gui.auth_message = \"Hello\"\n",
416
- "app = gr.mount_gradio_app(app, gradio_gui, path=\"/gradio\")"
417
  ]
418
  },
419
  {
420
  "cell_type": "code",
421
- "execution_count": null,
422
  "id": "f089dfd7",
423
  "metadata": {},
424
- "outputs": [],
 
 
 
 
 
 
 
 
425
  "source": [
426
  "%%writefile main.py\n",
427
- "import uvicorn\n",
428
  "\n",
429
- "if __name__ == \"__main__\":\n",
430
- " uvicorn.run(f\"app.app:app\", host=\"0.0.0.0\", port=8000, log_level=\"info\")"
431
  ]
432
  },
433
  {
434
  "cell_type": "code",
435
  "execution_count": null,
436
- "id": "cb53f0ae",
437
  "metadata": {},
438
  "outputs": [],
439
  "source": [
440
- "!python -m pipreqs.pipreqs ."
 
 
 
 
 
 
 
 
 
 
441
  ]
442
  },
443
  {
@@ -445,17 +534,121 @@
445
  "execution_count": null,
446
  "id": "a20f7f8c",
447
  "metadata": {},
448
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  "source": [
450
  "!python main.py"
451
  ]
452
  },
453
  {
454
  "cell_type": "code",
455
- "execution_count": null,
456
  "id": "65658ef7",
457
  "metadata": {},
458
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  "source": [
460
  "import contextlib\n",
461
  "\n",
@@ -494,6 +687,36 @@
494
  " await create_user(email=email, password=password)"
495
  ]
496
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
  {
498
  "cell_type": "code",
499
  "execution_count": null,
@@ -503,6 +726,62 @@
503
  "source": [
504
  "!git commit -m \"adding chatbot\""
505
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  }
507
  ],
508
  "metadata": {
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 8,
6
  "id": "4fca2e60",
7
  "metadata": {},
8
  "outputs": [],
 
12
  },
13
  {
14
  "cell_type": "code",
15
+ "execution_count": 9,
16
  "id": "a4ffa93a",
17
  "metadata": {},
18
+ "outputs": [
19
+ {
20
+ "name": "stdout",
21
+ "output_type": "stream",
22
+ "text": [
23
+ "Overwriting app/db.py\n"
24
+ ]
25
+ }
26
+ ],
27
  "source": [
28
  "%%writefile app/db.py\n",
29
  "from typing import AsyncGenerator\n",
 
79
  },
80
  {
81
  "cell_type": "code",
82
+ "execution_count": 10,
83
  "id": "d2a08335",
84
  "metadata": {},
85
+ "outputs": [
86
+ {
87
+ "name": "stdout",
88
+ "output_type": "stream",
89
+ "text": [
90
+ "Overwriting app/schemas.py\n"
91
+ ]
92
+ }
93
+ ],
94
  "source": [
95
  "%%writefile app/schemas.py\n",
96
  "import uuid\n",
 
112
  },
113
  {
114
  "cell_type": "code",
115
+ "execution_count": 11,
116
  "id": "9d649fcc",
117
  "metadata": {},
118
+ "outputs": [
119
+ {
120
+ "name": "stdout",
121
+ "output_type": "stream",
122
+ "text": [
123
+ "Overwriting app/users.py\n"
124
+ ]
125
+ }
126
+ ],
127
  "source": [
128
  "%%writefile app/users.py\n",
129
  "import uuid\n",
 
198
  },
199
  {
200
  "cell_type": "code",
201
+ "execution_count": 38,
202
  "id": "d2250413",
203
  "metadata": {},
204
+ "outputs": [
205
+ {
206
+ "name": "stdout",
207
+ "output_type": "stream",
208
+ "text": [
209
+ "Overwriting app/app.py\n"
210
+ ]
211
+ }
212
+ ],
213
  "source": [
214
  "%%writefile app/app.py\n",
215
  "import httpx\n",
 
304
  " # Extract and return the AI's response from the API response\n",
305
  " return completion.choices[0].message.content.strip()\n",
306
  "\n",
307
+ "def get_ai_image(prompt, size=\"512x512\"):\n",
308
+ " response = openai.Image.create(\n",
309
+ " prompt=prompt,\n",
310
+ " n=1,\n",
311
+ " size=size\n",
312
+ " )\n",
313
+ " image_1_url = response.data[0]['url']\n",
314
+ " return image_1_url\n",
315
+ "\n",
316
+ "def get_ai_transcript(path_to_audio, language=None):\n",
317
+ " audio_file= open(path_to_audio, \"rb\")\n",
318
+ " transcript = openai.Audio.transcribe(\"whisper-1\", audio_file, language=language)\n",
319
+ " return transcript.text\n",
320
+ "\n",
321
+ "def generate_transcription(path_to_audio_file):\n",
322
+ " try:\n",
323
+ " transcript = get_ai_transcript(path_to_audio_file)\n",
324
+ " return transcript\n",
325
+ " except Exception as e:\n",
326
+ " raise gr.Error(e)\n",
327
+ " return \"\"\n",
328
+ " \n",
329
+ "def generate_image(prompt):\n",
330
+ " try:\n",
331
+ " image_url = get_ai_image(prompt)\n",
332
+ " return image_url\n",
333
+ " except Exception as e:\n",
334
+ " raise gr.Error(e)\n",
335
+ " return None\n",
336
+ " \n",
337
  "# Define a function to handle the chat interaction with the AI model\n",
338
  "def chat(model, system_message, message, chatbot_messages, history_state):\n",
339
  " # Initialize chatbot_messages and history_state if they are not provided\n",
 
406
  " example_load_btn.click(choose_example, inputs=[example_dropdown], outputs=[system_message, message, chatbot, history_state])\n",
407
  " # Connect the send button to the chat function\n",
408
  " btn.click(chat, inputs=[model_selector, system_message, message, chatbot, history_state], outputs=[message, chatbot, history_state])\n",
409
+ " with gr.Tab(\"Image Generation\"):\n",
410
+ " image_prompt = gr.Textbox(label=\"Prompt\", placeholder=\"A cute puppy wearing sunglasses.\")\n",
411
+ " image_btn = gr.Button(value=\"Generate\")\n",
412
+ " image = gr.Image(label=\"Result\", interactive=False, type=\"filepath\")\n",
413
+ " image_btn.click(generate_image, inputs=[image_prompt], outputs=[image])\n",
414
+ " with gr.Tab(\"Speech-to-text\"):\n",
415
+ " audio_file = gr.Audio(label=\"Audio\", source=\"microphone\", type=\"filepath\")\n",
416
+ " transcribe = gr.Button(value=\"Transcribe\")\n",
417
+ " audio_transcript = gr.Textbox(label=\"Transcription\", interactive=False)\n",
418
+ " transcribe.click(generate_transcription, inputs=[audio_file], outputs=[audio_transcript])\n",
419
  " with gr.Tab(\"Get API Key\"):\n",
420
  " email_box = gr.Textbox(label=\"Email Address\", placeholder=\"Student Email\")\n",
421
  " password_box = gr.Textbox(label=\"Password\", type=\"password\", placeholder=\"Student ID\")\n",
 
484
  " \n",
485
  "gradio_gui = get_chatbot_app()\n",
486
  "gradio_gui.auth = api_login\n",
487
+ "gradio_gui.auth_message = \"Welcome, to the 3341 OpenAI Service\"\n",
488
+ "app = gr.mount_gradio_app(app, gradio_gui, path=\"/\")"
489
  ]
490
  },
491
  {
492
  "cell_type": "code",
493
+ "execution_count": 16,
494
  "id": "f089dfd7",
495
  "metadata": {},
496
+ "outputs": [
497
+ {
498
+ "name": "stdout",
499
+ "output_type": "stream",
500
+ "text": [
501
+ "Overwriting main.py\n"
502
+ ]
503
+ }
504
+ ],
505
  "source": [
506
  "%%writefile main.py\n",
507
+ "import subprocess\n",
508
  "\n",
509
+ "subprocess.run(\"uvicorn app.app:app --host 0.0.0.0 --port 7860\", shell=True)"
 
510
  ]
511
  },
512
  {
513
  "cell_type": "code",
514
  "execution_count": null,
515
+ "id": "9039be08",
516
  "metadata": {},
517
  "outputs": [],
518
  "source": [
519
+ "%%writefile requirements.txt\n",
520
+ "fastapi==0.95.1\n",
521
+ "fastapi-users-db-sqlalchemy<5.0.0\n",
522
+ "gradio==3.27.0\n",
523
+ "httpx==0.24.0\n",
524
+ "openai==0.27.4\n",
525
+ "python-dotenv==1.0.0\n",
526
+ "Requests==2.28.2\n",
527
+ "SQLAlchemy==1.4.47\n",
528
+ "uvicorn==0.21.1\n",
529
+ "asyncpg==0.27.0"
530
  ]
531
  },
532
  {
 
534
  "execution_count": null,
535
  "id": "a20f7f8c",
536
  "metadata": {},
537
+ "outputs": [
538
+ {
539
+ "name": "stdout",
540
+ "output_type": "stream",
541
+ "text": [
542
+ "\u001b[32mINFO\u001b[0m: Started server process [\u001b[36m77691\u001b[0m]\n",
543
+ "\u001b[32mINFO\u001b[0m: Waiting for application startup.\n",
544
+ "\u001b[32mINFO\u001b[0m: Application startup complete.\n",
545
+ "\u001b[32mINFO\u001b[0m: Uvicorn running on \u001b[1mhttp://0.0.0.0:7860\u001b[0m (Press CTRL+C to quit)\n",
546
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58808 - \"\u001b[1mGET / HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
547
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58808 - \"\u001b[1mGET /theme.css HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
548
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58810 - \"\u001b[1mPOST /auth/jwt/login HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
549
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mPOST /login HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
550
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mGET / HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
551
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mGET /theme.css HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n"
552
+ ]
553
+ }
554
+ ],
555
  "source": [
556
  "!python main.py"
557
  ]
558
  },
559
  {
560
  "cell_type": "code",
561
+ "execution_count": 4,
562
  "id": "65658ef7",
563
  "metadata": {},
564
+ "outputs": [
565
+ {
566
+ "name": "stdout",
567
+ "output_type": "stream",
568
+ "text": [
569
+ "User 30d58c0b-04c8-4e55-89e5-878b08472884 has registered.\n",
570
+ "User created <app.db.User object at 0x1061dec80>\n",
571
+ "User 2a622947-16bd-4963-abc8-30a3766338c4 has registered.\n",
572
+ "User created <app.db.User object at 0x1061de440>\n",
573
+ "User 23e72a35-10e0-469d-8fc6-7b6f1f8fc5a3 has registered.\n",
574
+ "User created <app.db.User object at 0x1061de470>\n",
575
+ "User 85bcf4f4-db65-404d-b2ef-e23283462bfa has registered.\n",
576
+ "User created <app.db.User object at 0x1064ca410>\n",
577
+ "User 7df12d26-1f30-4b74-9d8c-975d68e0df9f has registered.\n",
578
+ "User created <app.db.User object at 0x1064c9c60>\n",
579
+ "User 1cd64c6e-bcde-4009-af24-6bee05e7afd8 has registered.\n",
580
+ "User created <app.db.User object at 0x1064ca410>\n",
581
+ "User 88b0449c-e604-4d57-bd0c-797a930efa05 has registered.\n",
582
+ "User created <app.db.User object at 0x1064cad10>\n",
583
+ "User 68242f26-a22b-49e8-8b8c-c4475e01dcd4 has registered.\n",
584
+ "User created <app.db.User object at 0x1064c9b70>\n",
585
+ "User 61b685a4-3df5-4baf-bb61-b4f93150699f has registered.\n",
586
+ "User created <app.db.User object at 0x1064cba00>\n",
587
+ "User 8443d506-859e-4f89-b301-6c08e56d34e1 has registered.\n",
588
+ "User created <app.db.User object at 0x1064cad10>\n",
589
+ "User 1adee351-777e-46ff-83be-379db22cc2d7 has registered.\n",
590
+ "User created <app.db.User object at 0x1064c9b70>\n",
591
+ "User 5654743e-fd1e-477d-97e0-f4eb138d2935 has registered.\n",
592
+ "User created <app.db.User object at 0x1064c97b0>\n",
593
+ "User 57c96dd2-6291-447d-9070-ca9c335798ba has registered.\n",
594
+ "User created <app.db.User object at 0x1064cbc70>\n",
595
+ "User 6a105d49-e84f-4d95-98ed-577b4a970854 has registered.\n",
596
+ "User created <app.db.User object at 0x1064cbb80>\n",
597
+ "User 6a17151f-60ad-42ae-8fef-2890a77ee0f8 has registered.\n",
598
+ "User created <app.db.User object at 0x1064c81c0>\n",
599
+ "User badec4ec-fee6-4832-bb89-1bf1501167ff has registered.\n",
600
+ "User created <app.db.User object at 0x1064cba90>\n",
601
+ "User 6c1a749e-fa19-44bd-b937-e508e78866cd has registered.\n",
602
+ "User created <app.db.User object at 0x1064c9cc0>\n",
603
+ "User 7c9aa8fe-d3e4-4af3-919a-20294d68fc4b has registered.\n",
604
+ "User created <app.db.User object at 0x1064c92d0>\n",
605
+ "User a93183b3-5aa1-4e06-a78f-a47be0b2bba1 has registered.\n",
606
+ "User created <app.db.User object at 0x1064cab00>\n",
607
+ "User 3abc7ae3-0185-4742-bf1d-f3749cecb199 has registered.\n",
608
+ "User created <app.db.User object at 0x1064cb850>\n",
609
+ "User e6e9eda6-80e2-40bd-be8c-4d371deddb4e has registered.\n",
610
+ "User created <app.db.User object at 0x1064c9780>\n",
611
+ "User a3587907-b38f-4291-8153-34d480d8ebfe has registered.\n",
612
+ "User created <app.db.User object at 0x1064cab00>\n",
613
+ "User 4de62323-12ba-41cc-bd72-60a53117236e has registered.\n",
614
+ "User created <app.db.User object at 0x1064c9510>\n",
615
+ "User fa7ae58a-e5d4-4495-9aec-d10f1076b291 has registered.\n",
616
+ "User created <app.db.User object at 0x1064c9240>\n",
617
+ "User a3d49925-470c-485b-85c7-b881fc6103bd has registered.\n",
618
+ "User created <app.db.User object at 0x1064cad10>\n",
619
+ "User 1aded816-081c-4c16-b6fb-5a8514acecbd has registered.\n",
620
+ "User created <app.db.User object at 0x1064c9930>\n",
621
+ "User c05807bb-5e02-4e9d-a5dd-870b40beeab9 has registered.\n",
622
+ "User created <app.db.User object at 0x1061de830>\n",
623
+ "User e3840eef-2ccc-43e8-bb98-f67e1d78d595 has registered.\n",
624
+ "User created <app.db.User object at 0x1064ca860>\n",
625
+ "User 177862c8-f84a-4e9a-8a11-325c1af34476 has registered.\n",
626
+ "User created <app.db.User object at 0x106222cb0>\n",
627
+ "User 833a7089-f258-4261-86a9-6aa874ccc7b2 has registered.\n",
628
+ "User created <app.db.User object at 0x106223040>\n",
629
+ "User c9f0147c-b880-4814-a272-3c91625ebfe2 has registered.\n",
630
+ "User created <app.db.User object at 0x106222cb0>\n",
631
+ "User 182b4c76-2cba-407c-965c-eea8ec17ef6f has registered.\n",
632
+ "User created <app.db.User object at 0x106223880>\n",
633
+ "User c79f3346-cf21-4e41-8393-c36aaeab67fe has registered.\n",
634
+ "User created <app.db.User object at 0x106223e50>\n",
635
+ "User 610705ed-b7ac-4296-b566-db6bdf642f5a has registered.\n",
636
+ "User created <app.db.User object at 0x106223ca0>\n",
637
+ "User 09817885-888b-4be9-9d20-fd03366f6791 has registered.\n",
638
+ "User created <app.db.User object at 0x106223880>\n",
639
+ "User 5c38dc47-7c00-4d68-ac7c-9ec2c7c4a6ea has registered.\n",
640
+ "User created <app.db.User object at 0x1064c88b0>\n",
641
+ "User 1009694f-b1e4-4751-a59c-a8ed757f76f1 has registered.\n",
642
+ "User created <app.db.User object at 0x1064c9ae0>\n",
643
+ "User b5fb3dbc-a8c0-4221-897f-9eb87ff29ced has registered.\n",
644
+ "User created <app.db.User object at 0x1064cba30>\n",
645
+ "User 3269239e-e87b-4f6f-9539-4d7fffc1d9a1 has registered.\n",
646
+ "User created <app.db.User object at 0x1064c9f00>\n",
647
+ "User 59bb7f37-d029-47a1-8bbd-37adae350fed has registered.\n",
648
+ "User created <app.db.User object at 0x1064c9ae0>\n"
649
+ ]
650
+ }
651
+ ],
652
  "source": [
653
  "import contextlib\n",
654
  "\n",
 
687
  " await create_user(email=email, password=password)"
688
  ]
689
  },
690
+ {
691
+ "cell_type": "code",
692
+ "execution_count": null,
693
+ "id": "406b1bd5",
694
+ "metadata": {},
695
+ "outputs": [],
696
+ "source": [
697
+ "!git add app"
698
+ ]
699
+ },
700
+ {
701
+ "cell_type": "code",
702
+ "execution_count": null,
703
+ "id": "4849ce67",
704
+ "metadata": {},
705
+ "outputs": [],
706
+ "source": [
707
+ "!git add requirements.txt"
708
+ ]
709
+ },
710
+ {
711
+ "cell_type": "code",
712
+ "execution_count": null,
713
+ "id": "54c436ed",
714
+ "metadata": {},
715
+ "outputs": [],
716
+ "source": [
717
+ "!git add main.py"
718
+ ]
719
+ },
720
  {
721
  "cell_type": "code",
722
  "execution_count": null,
 
726
  "source": [
727
  "!git commit -m \"adding chatbot\""
728
  ]
729
+ },
730
+ {
731
+ "cell_type": "code",
732
+ "execution_count": null,
733
+ "id": "bda07f88",
734
+ "metadata": {},
735
+ "outputs": [],
736
+ "source": [
737
+ "!pip -q install --upgrade huggingface_hub"
738
+ ]
739
+ },
740
+ {
741
+ "cell_type": "code",
742
+ "execution_count": null,
743
+ "id": "39516b2a",
744
+ "metadata": {},
745
+ "outputs": [],
746
+ "source": [
747
+ "from huggingface_hub import notebook_login\n",
748
+ "notebook_login()"
749
+ ]
750
+ },
751
+ {
752
+ "cell_type": "code",
753
+ "execution_count": 42,
754
+ "id": "83bdbe1d",
755
+ "metadata": {},
756
+ "outputs": [],
757
+ "source": [
758
+ "!git remote add huggingface https://huggingface.co/spaces/ericmichael/openai-playground-utrgv"
759
+ ]
760
+ },
761
+ {
762
+ "cell_type": "code",
763
+ "execution_count": 43,
764
+ "id": "db9d1e70",
765
+ "metadata": {},
766
+ "outputs": [
767
+ {
768
+ "name": "stdout",
769
+ "output_type": "stream",
770
+ "text": [
771
+ "Enumerating objects: 19, done.\n",
772
+ "Counting objects: 100% (19/19), done.\n",
773
+ "Delta compression using up to 8 threads\n",
774
+ "Compressing objects: 100% (18/18), done.\n",
775
+ "Writing objects: 100% (19/19), 13.39 KiB | 6.70 MiB/s, done.\n",
776
+ "Total 19 (delta 3), reused 0 (delta 0), pack-reused 0\n",
777
+ "error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)\n",
778
+ "Everything up-to-date\n"
779
+ ]
780
+ }
781
+ ],
782
+ "source": [
783
+ "!git push --force huggingface main"
784
+ ]
785
  }
786
  ],
787
  "metadata": {