Skip to content

Commit

Permalink
💻 Added examples for ConverseBot and WhizBot
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad-saad-2000 committed Jul 22, 2023
1 parent cdceb18 commit 6b0d65a
Show file tree
Hide file tree
Showing 5 changed files with 29,966 additions and 0 deletions.
128 changes: 128 additions & 0 deletions examples/ConverseBot/ConverseBot.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/codespace/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n",
"/home/codespace/.local/lib/python3.10/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work\n",
" warn(\"Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work\", RuntimeWarning)\n",
"2023-07-22 20:55:43.870885: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
"To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"2023-07-22 20:55:50.513410: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n"
]
}
],
"source": [
"from botiverse.bots.ConverseBot.ConverseBot import ConverseBot\n",
"from botiverse import chat_gui"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * Serving Flask app 'botiverse.gui.gui'\n",
" * Debug mode: off\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n",
" * Running on http://127.0.0.1:5000\n",
"Press CTRL+C to quit\n",
"127.0.0.1 - - [22/Jul/2023 20:57:05] \"GET / HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:57:05] \"GET /static/style.css HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:57:06] \"GET /static/logo.png HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:57:06] \"GET /static/icons/Converse%20Bot.png HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:57:06] \"GET /static/favicon.png HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:57:14] \"POST /get HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:57:36] \"POST /get HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 20:59:17] \"POST /get HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 21:02:43] \"GET / HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 21:02:44] \"GET /static/style.css HTTP/1.1\" 304 -\n",
"127.0.0.1 - - [22/Jul/2023 21:02:44] \"GET /static/logo.png HTTP/1.1\" 304 -\n",
"127.0.0.1 - - [22/Jul/2023 21:02:44] \"GET /static/icons/Converse%20Bot.png HTTP/1.1\" 304 -\n",
"127.0.0.1 - - [22/Jul/2023 21:02:44] \"GET /static/favicon.png HTTP/1.1\" 304 -\n",
"127.0.0.1 - - [22/Jul/2023 21:02:50] \"POST /get HTTP/1.1\" 200 -\n",
"127.0.0.1 - - [22/Jul/2023 21:04:17] \"POST /get HTTP/1.1\" 200 -\n"
]
},
{
"data": {
"text/plain": [
"<botiverse.gui.gui.chat_gui at 0x7fe251987f70>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bot = ConverseBot()\n",
"chat_gui('Converse Bot', bot.infer)\n",
"# bot.read_data(\"conversations.json\")\n",
"# bot.train(epochs=1, batch_size=1)\n",
"# bot.save_model(\"conversebot.pt\")\n",
"bot.infer(\"What is Wikipedia?\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Wikipedia is a free and open-source website that provides a wide range of information on a wide range of topics, including science, technology, politics, and culture. It is owned by the National Academies of Sciences, Engineering, and Medicine (Nasdaq), and has been continuously updated to reflect the latest developments in the field.'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bot = ConverseBot()\n",
"chat_gui('Converse Bot', bot.infer)"
]
}
],
"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.10.8"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 6b0d65a

Please sign in to comment.