From c52707af5d84370580e36e28b50fe87b75bcf774 Mon Sep 17 00:00:00 2001 From: Jheel19 Date: Sat, 6 Jul 2024 15:21:41 +0530 Subject: [PATCH] Added python notebook --- medicine_details_chatbot.ipynb | 3141 ++++++++++++++++++++++++++++++++ 1 file changed, 3141 insertions(+) create mode 100644 medicine_details_chatbot.ipynb diff --git a/medicine_details_chatbot.ipynb b/medicine_details_chatbot.ipynb new file mode 100644 index 0000000..f718f32 --- /dev/null +++ b/medicine_details_chatbot.ipynb @@ -0,0 +1,3141 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "gpuType": "T4" + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "accelerator": "GPU", + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "48a76c68ca374645980329777f5efdc3": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_de6e0636c1724086a70e76aa1a7b9f37", + "IPY_MODEL_4ad333ede84545ff825b370c10254812", + "IPY_MODEL_7e7b30b9c3424f0fb6c1b5b1e17e37e9" + ], + "layout": "IPY_MODEL_497aae416c3744c097b5f4e20980c21a" + } + }, + "de6e0636c1724086a70e76aa1a7b9f37": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_fe054fd107a148d99c28d5447ef2da15", + "placeholder": "​", + "style": "IPY_MODEL_91bfa2ae07c546089a264a4d62ee4c71", + "value": "tokenizer_config.json: 100%" + } + }, + "4ad333ede84545ff825b370c10254812": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_ed0f648fd5834bd4af38da225d60177c", + "max": 48, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_4db3ef8cabed415691deaa6b240f6134", + "value": 48 + } + }, + "7e7b30b9c3424f0fb6c1b5b1e17e37e9": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_ead5a02848ae494395635c93d3fcb0b9", + "placeholder": "​", + "style": "IPY_MODEL_20bd1737ecfc4c16b97a006b2f14e6cb", + "value": " 48.0/48.0 [00:00<00:00, 1.80kB/s]" + } + }, + "497aae416c3744c097b5f4e20980c21a": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "fe054fd107a148d99c28d5447ef2da15": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "91bfa2ae07c546089a264a4d62ee4c71": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "ed0f648fd5834bd4af38da225d60177c": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "4db3ef8cabed415691deaa6b240f6134": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "ead5a02848ae494395635c93d3fcb0b9": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "20bd1737ecfc4c16b97a006b2f14e6cb": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "56956a306aa140b98f49870d03c44a4c": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_49aee962ec7b4da28a06b95dedddc22c", + "IPY_MODEL_2be9241055b24ce4bfebf3260f2861ec", + "IPY_MODEL_a2a356f21f4f47ffacb4fa17782cdbc7" + ], + "layout": "IPY_MODEL_97d634b467cc4b758bc787078c0c535e" + } + }, + "49aee962ec7b4da28a06b95dedddc22c": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_aec9bd122216436baec9fc5f1443cb49", + "placeholder": "​", + "style": "IPY_MODEL_9138a92bef2e4c628455096b0550e49d", + "value": "vocab.txt: 100%" + } + }, + "2be9241055b24ce4bfebf3260f2861ec": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_40cae393c7bd402e81037fc8dc933d8b", + "max": 231508, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_027dab170d024a4ba57448d1988c84e7", + "value": 231508 + } + }, + "a2a356f21f4f47ffacb4fa17782cdbc7": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_aecb4bc8d2b847bab696e4e4e297d148", + "placeholder": "​", + "style": "IPY_MODEL_0e07c7b1c85045f2a4ce4044e21250e6", + "value": " 232k/232k [00:00<00:00, 1.66MB/s]" + } + }, + "97d634b467cc4b758bc787078c0c535e": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "aec9bd122216436baec9fc5f1443cb49": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "9138a92bef2e4c628455096b0550e49d": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "40cae393c7bd402e81037fc8dc933d8b": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "027dab170d024a4ba57448d1988c84e7": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "aecb4bc8d2b847bab696e4e4e297d148": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "0e07c7b1c85045f2a4ce4044e21250e6": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "4f2dd7d15f664b62a6415bfe80c73dfc": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_227ef92a0aeb474fbbfbd0ebdda5ddf9", + "IPY_MODEL_12c35f7b84d64fb2bc963cd978cf5905", + "IPY_MODEL_f816f1f83573432c876bba535935b9d7" + ], + "layout": "IPY_MODEL_c5be2f2085e0445fb3ee7fb4d378c099" + } + }, + "227ef92a0aeb474fbbfbd0ebdda5ddf9": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_dee4ab674fe74207af6e28a9e1ea0f64", + "placeholder": "​", + "style": "IPY_MODEL_76099690bad04b8785d56d14ac3e911f", + "value": "tokenizer.json: 100%" + } + }, + "12c35f7b84d64fb2bc963cd978cf5905": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_076b24997ad24806bbfca93d291cf257", + "max": 466062, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_1e3dce1390c34d7286a46c909e7189e3", + "value": 466062 + } + }, + "f816f1f83573432c876bba535935b9d7": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_70af681bab9841c983d625c6064b5947", + "placeholder": "​", + "style": "IPY_MODEL_4fa334d50b3f404096384c36e4889d63", + "value": " 466k/466k [00:00<00:00, 3.61MB/s]" + } + }, + "c5be2f2085e0445fb3ee7fb4d378c099": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "dee4ab674fe74207af6e28a9e1ea0f64": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "76099690bad04b8785d56d14ac3e911f": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "076b24997ad24806bbfca93d291cf257": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1e3dce1390c34d7286a46c909e7189e3": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "70af681bab9841c983d625c6064b5947": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "4fa334d50b3f404096384c36e4889d63": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "28509e5d71474c888ae5542a1fbf37fe": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_01988eeeddc140faa9add4a96b609e33", + "IPY_MODEL_8d90a5a3af304bc797c4468006e44eb6", + "IPY_MODEL_b2a87bf15f584cc9b692d4f822239151" + ], + "layout": "IPY_MODEL_06ac586b88a44312a0863f8693464a8c" + } + }, + "01988eeeddc140faa9add4a96b609e33": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_e455a19cefd34d3c8096b55e0db47ba7", + "placeholder": "​", + "style": "IPY_MODEL_7606bd660af0414a80078b82d35a0cc2", + "value": "config.json: 100%" + } + }, + "8d90a5a3af304bc797c4468006e44eb6": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_3dd327a297974dd6ab126d3fd1dcc250", + "max": 483, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_76452981ed674b1abd97ed5451a76afd", + "value": 483 + } + }, + "b2a87bf15f584cc9b692d4f822239151": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_c33de50287384adab8f62ef1b9a0917f", + "placeholder": "​", + "style": "IPY_MODEL_9a89d5f988014afd94b1d73de4b0633a", + "value": " 483/483 [00:00<00:00, 7.60kB/s]" + } + }, + "06ac586b88a44312a0863f8693464a8c": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e455a19cefd34d3c8096b55e0db47ba7": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "7606bd660af0414a80078b82d35a0cc2": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "3dd327a297974dd6ab126d3fd1dcc250": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "76452981ed674b1abd97ed5451a76afd": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "c33de50287384adab8f62ef1b9a0917f": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "9a89d5f988014afd94b1d73de4b0633a": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "920ec347c09742dfb6c1217aebf2b168": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_df8ecb68af944327b6912e03fd343e98", + "IPY_MODEL_2e36c543f1c64f3791d4caac8fd42ef3", + "IPY_MODEL_f2085944b6974f7386ad1ecb7aaab039" + ], + "layout": "IPY_MODEL_20d96622e1f046a48e7f351298260d27" + } + }, + "df8ecb68af944327b6912e03fd343e98": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_296d129263034380be801e051054df96", + "placeholder": "​", + "style": "IPY_MODEL_5796862e59de4c789658cae2e88a32fd", + "value": "model.safetensors: 100%" + } + }, + "2e36c543f1c64f3791d4caac8fd42ef3": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_d70ff1b47ae04627843bfff486403e0e", + "max": 267954768, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_da02ba6d7eed47e486e93a30e5997626", + "value": 267954768 + } + }, + "f2085944b6974f7386ad1ecb7aaab039": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_cddb71e762e14d2f820f6d46d1950d15", + "placeholder": "​", + "style": "IPY_MODEL_55811a18ddcc46718b6112ac2be24f2a", + "value": " 268M/268M [00:01<00:00, 171MB/s]" + } + }, + "20d96622e1f046a48e7f351298260d27": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "296d129263034380be801e051054df96": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "5796862e59de4c789658cae2e88a32fd": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "d70ff1b47ae04627843bfff486403e0e": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "da02ba6d7eed47e486e93a30e5997626": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "cddb71e762e14d2f820f6d46d1950d15": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "55811a18ddcc46718b6112ac2be24f2a": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + } + } + } + }, + "cells": [ + { + "cell_type": "code", + "source": [ + "!pip install ffmpeg-python" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "UuATDTSXyL0N", + "outputId": "c53b7859-2126-4603-dbea-389cbb19d99c" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting ffmpeg-python\n", + " Downloading ffmpeg_python-0.2.0-py3-none-any.whl (25 kB)\n", + "Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from ffmpeg-python) (0.18.3)\n", + "Installing collected packages: ffmpeg-python\n", + "Successfully installed ffmpeg-python-0.2.0\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!pip install openai==0.28\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qG17Zg1eyJUk", + "outputId": "a59964ab-a8d4-4da0-f7c3-09b62969fc1c" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting openai==0.28\n", + " Downloading openai-0.28.0-py3-none-any.whl (76 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.5/76.5 kB\u001b[0m \u001b[31m2.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: requests>=2.20 in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (2.31.0)\n", + "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (4.66.4)\n", + "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (3.9.5)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2.0.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2024.6.2)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (4.0.3)\n", + "Installing collected packages: openai\n", + "Successfully installed openai-0.28.0\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!pip install gtts pydub\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "MrzMjjCuygBk", + "outputId": "f4d4d3af-9912-40aa-e403-39187f45d22f" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Collecting gtts\n", + " Downloading gTTS-2.5.1-py3-none-any.whl (29 kB)\n", + "Collecting pydub\n", + " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", + "Requirement already satisfied: requests<3,>=2.27 in /usr/local/lib/python3.10/dist-packages (from gtts) (2.31.0)\n", + "Requirement already satisfied: click<8.2,>=7.1 in /usr/local/lib/python3.10/dist-packages (from gtts) (8.1.7)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (2.0.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (2024.6.2)\n", + "Installing collected packages: pydub, gtts\n", + "Successfully installed gtts-2.5.1 pydub-0.25.1\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!pip install openai==0.28 gtts pydub transformers torch tqdm SpeechRecognition\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xb7X6zrVyjKX", + "outputId": "36c11930-5324-4506-eb3d-2809fed2b37e" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Requirement already satisfied: openai==0.28 in /usr/local/lib/python3.10/dist-packages (0.28.0)\n", + "Requirement already satisfied: gtts in /usr/local/lib/python3.10/dist-packages (2.5.1)\n", + "Requirement already satisfied: pydub in /usr/local/lib/python3.10/dist-packages (0.25.1)\n", + "Requirement already satisfied: transformers in /usr/local/lib/python3.10/dist-packages (4.41.2)\n", + "Requirement already satisfied: torch in /usr/local/lib/python3.10/dist-packages (2.3.0+cu121)\n", + "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (4.66.4)\n", + "Collecting SpeechRecognition\n", + " Downloading SpeechRecognition-3.10.4-py2.py3-none-any.whl (32.8 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m32.8/32.8 MB\u001b[0m \u001b[31m44.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: requests>=2.20 in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (2.31.0)\n", + "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (3.9.5)\n", + "Requirement already satisfied: click<8.2,>=7.1 in /usr/local/lib/python3.10/dist-packages (from gtts) (8.1.7)\n", + "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.15.4)\n", + "Requirement already satisfied: huggingface-hub<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.23.4)\n", + "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.25.2)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (24.1)\n", + "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0.1)\n", + "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2024.5.15)\n", + "Requirement already satisfied: tokenizers<0.20,>=0.19 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.19.1)\n", + "Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.4.3)\n", + "Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch) (4.12.2)\n", + "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch) (1.12.1)\n", + "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch) (3.3)\n", + "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch) (3.1.4)\n", + "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch) (2023.6.0)\n", + "Collecting nvidia-cuda-nvrtc-cu12==12.1.105 (from torch)\n", + " Using cached nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (23.7 MB)\n", + "Collecting nvidia-cuda-runtime-cu12==12.1.105 (from torch)\n", + " Using cached nvidia_cuda_runtime_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (823 kB)\n", + "Collecting nvidia-cuda-cupti-cu12==12.1.105 (from torch)\n", + " Using cached nvidia_cuda_cupti_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (14.1 MB)\n", + "Collecting nvidia-cudnn-cu12==8.9.2.26 (from torch)\n", + " Using cached nvidia_cudnn_cu12-8.9.2.26-py3-none-manylinux1_x86_64.whl (731.7 MB)\n", + "Collecting nvidia-cublas-cu12==12.1.3.1 (from torch)\n", + " Using cached nvidia_cublas_cu12-12.1.3.1-py3-none-manylinux1_x86_64.whl (410.6 MB)\n", + "Collecting nvidia-cufft-cu12==11.0.2.54 (from torch)\n", + " Using cached nvidia_cufft_cu12-11.0.2.54-py3-none-manylinux1_x86_64.whl (121.6 MB)\n", + "Collecting nvidia-curand-cu12==10.3.2.106 (from torch)\n", + " Using cached nvidia_curand_cu12-10.3.2.106-py3-none-manylinux1_x86_64.whl (56.5 MB)\n", + "Collecting nvidia-cusolver-cu12==11.4.5.107 (from torch)\n", + " Using cached nvidia_cusolver_cu12-11.4.5.107-py3-none-manylinux1_x86_64.whl (124.2 MB)\n", + "Collecting nvidia-cusparse-cu12==12.1.0.106 (from torch)\n", + " Using cached nvidia_cusparse_cu12-12.1.0.106-py3-none-manylinux1_x86_64.whl (196.0 MB)\n", + "Collecting nvidia-nccl-cu12==2.20.5 (from torch)\n", + " Using cached nvidia_nccl_cu12-2.20.5-py3-none-manylinux2014_x86_64.whl (176.2 MB)\n", + "Collecting nvidia-nvtx-cu12==12.1.105 (from torch)\n", + " Using cached nvidia_nvtx_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (99 kB)\n", + "Requirement already satisfied: triton==2.3.0 in /usr/local/lib/python3.10/dist-packages (from torch) (2.3.0)\n", + "Collecting nvidia-nvjitlink-cu12 (from nvidia-cusolver-cu12==11.4.5.107->torch)\n", + " Downloading nvidia_nvjitlink_cu12-12.5.82-py3-none-manylinux2014_x86_64.whl (21.3 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m21.3/21.3 MB\u001b[0m \u001b[31m72.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hRequirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2.0.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2024.6.2)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (23.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.4.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (6.0.5)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.9.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (4.0.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch) (2.1.5)\n", + "Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from sympy->torch) (1.3.0)\n", + "Installing collected packages: nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, SpeechRecognition, nvidia-cusparse-cu12, nvidia-cudnn-cu12, nvidia-cusolver-cu12\n", + "Successfully installed SpeechRecognition-3.10.4 nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.20.5 nvidia-nvjitlink-cu12-12.5.82 nvidia-nvtx-cu12-12.1.105\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import torch\n", + "from torch.utils.data import DataLoader, Dataset\n", + "from transformers import DistilBertTokenizer, DistilBertForSequenceClassification, AdamW, get_linear_schedule_with_warmup\n", + "from sklearn.model_selection import train_test_split\n", + "from tqdm import tqdm\n", + "from pydub import AudioSegment\n", + "from gtts import gTTS\n", + "import openai\n", + "import speech_recognition as sr\n", + "import numpy as np\n", + "import os\n", + "\n", + "# Set your OpenAI API key\n", + "openai.api_key = \"sk-proj-Hosg4gZzlwor4O6CJtevT3BlbkFJ6WrunCU6UjU3Uqy0LW8f\"\n", + "\n", + "# Load the dataset\n", + "data = pd.read_csv(\"/content/Medicine_Details.csv\")\n", + "\n", + "def preprocess_data(data):\n", + " # Assuming all medicines are \"Excellent\" for simplicity\n", + " data['Label'] = 0\n", + " return data[['Medicine Name', 'Composition', 'Uses', 'Side_effects', 'Manufacturer', 'Label']]\n", + "\n", + "data = preprocess_data(data)\n", + "\n", + "class MedicineDataset(Dataset):\n", + " def __init__(self, data, tokenizer, max_len=128):\n", + " self.data = data\n", + " self.tokenizer = tokenizer\n", + " self.max_len = max_len\n", + "\n", + " def __len__(self):\n", + " return len(self.data)\n", + "\n", + " def __getitem__(self, idx):\n", + " row = self.data.iloc[idx]\n", + " text = f\"{row['Composition']} {row['Uses']} {row['Side_effects']} {row['Manufacturer']}\"\n", + " inputs = self.tokenizer.encode_plus(\n", + " text,\n", + " add_special_tokens=True,\n", + " max_length=self.max_len,\n", + " padding='max_length',\n", + " return_attention_mask=True,\n", + " return_tensors='pt',\n", + " truncation=True\n", + " )\n", + " return {\n", + " 'input_ids': inputs['input_ids'].flatten(),\n", + " 'attention_mask': inputs['attention_mask'].flatten(),\n", + " 'labels': torch.tensor(row['Label'], dtype=torch.long)\n", + " }\n", + "\n", + "# Split the data\n", + "train_data, test_data = train_test_split(data, test_size=0.2, random_state=42)\n", + "\n", + "# Load tokenizer\n", + "tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')\n", + "\n", + "# Create datasets\n", + "train_dataset = MedicineDataset(train_data, tokenizer)\n", + "test_dataset = MedicineDataset(test_data, tokenizer)\n", + "\n", + "# Create data loaders\n", + "train_loader = DataLoader(train_dataset, batch_size=16, shuffle=True)\n", + "test_loader = DataLoader(test_dataset, batch_size=16)\n", + "\n", + "# Load model\n", + "model = DistilBertForSequenceClassification.from_pretrained('distilbert-base-uncased', num_labels=3)\n", + "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n", + "model.to(device)\n", + "\n", + "# Set up optimizer, scheduler, and loss function\n", + "optimizer = AdamW(model.parameters(), lr=5e-5)\n", + "total_steps = len(train_loader) * 3 # 3 epochs\n", + "scheduler = get_linear_schedule_with_warmup(optimizer, num_warmup_steps=0, num_training_steps=total_steps)\n", + "\n", + "# Training loop\n", + "num_epochs = 3\n", + "gradient_accumulation_steps = 2\n", + "early_stopping_patience = 2\n", + "best_loss = float('inf')\n", + "patience_counter = 0\n", + "\n", + "for epoch in range(num_epochs):\n", + " model.train()\n", + " running_loss = 0.0\n", + " for i, batch in enumerate(tqdm(train_loader)):\n", + " inputs, labels = batch['input_ids'].to(device), batch['labels'].to(device)\n", + " attention_mask = batch['attention_mask'].to(device)\n", + "\n", + " outputs = model(input_ids=inputs, attention_mask=attention_mask, labels=labels)\n", + " loss = outputs.loss / gradient_accumulation_steps\n", + " loss.backward()\n", + "\n", + " if (i + 1) % gradient_accumulation_steps == 0:\n", + " optimizer.step()\n", + " scheduler.step()\n", + " optimizer.zero_grad()\n", + "\n", + " running_loss += loss.item() * gradient_accumulation_steps\n", + "\n", + " avg_loss = running_loss / len(train_loader)\n", + " print(f\"Epoch {epoch + 1}, Loss: {avg_loss}\")\n", + "\n", + " # Early stopping\n", + " model.eval()\n", + " val_loss = 0.0\n", + " with torch.no_grad():\n", + " for batch in test_loader:\n", + " inputs, labels = batch['input_ids'].to(device), batch['labels'].to(device)\n", + " attention_mask = batch['attention_mask'].to(device)\n", + "\n", + " outputs = model(input_ids=inputs, attention_mask=attention_mask, labels=labels)\n", + " loss = outputs.loss\n", + " val_loss += loss.item()\n", + "\n", + " val_loss /= len(test_loader)\n", + " print(f\"Validation Loss: {val_loss}\")\n", + "\n", + " if val_loss < best_loss:\n", + " best_loss = val_loss\n", + " patience_counter = 0\n", + " else:\n", + " patience_counter += 1\n", + "\n", + " if patience_counter >= early_stopping_patience:\n", + " print(\"Early stopping triggered.\")\n", + " break\n", + "\n", + "\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 561, + "referenced_widgets": [ + "48a76c68ca374645980329777f5efdc3", + "de6e0636c1724086a70e76aa1a7b9f37", + "4ad333ede84545ff825b370c10254812", + "7e7b30b9c3424f0fb6c1b5b1e17e37e9", + "497aae416c3744c097b5f4e20980c21a", + "fe054fd107a148d99c28d5447ef2da15", + "91bfa2ae07c546089a264a4d62ee4c71", + "ed0f648fd5834bd4af38da225d60177c", + "4db3ef8cabed415691deaa6b240f6134", + "ead5a02848ae494395635c93d3fcb0b9", + "20bd1737ecfc4c16b97a006b2f14e6cb", + "56956a306aa140b98f49870d03c44a4c", + "49aee962ec7b4da28a06b95dedddc22c", + "2be9241055b24ce4bfebf3260f2861ec", + "a2a356f21f4f47ffacb4fa17782cdbc7", + "97d634b467cc4b758bc787078c0c535e", + "aec9bd122216436baec9fc5f1443cb49", + "9138a92bef2e4c628455096b0550e49d", + "40cae393c7bd402e81037fc8dc933d8b", + "027dab170d024a4ba57448d1988c84e7", + "aecb4bc8d2b847bab696e4e4e297d148", + "0e07c7b1c85045f2a4ce4044e21250e6", + "4f2dd7d15f664b62a6415bfe80c73dfc", + "227ef92a0aeb474fbbfbd0ebdda5ddf9", + "12c35f7b84d64fb2bc963cd978cf5905", + "f816f1f83573432c876bba535935b9d7", + "c5be2f2085e0445fb3ee7fb4d378c099", + "dee4ab674fe74207af6e28a9e1ea0f64", + "76099690bad04b8785d56d14ac3e911f", + "076b24997ad24806bbfca93d291cf257", + "1e3dce1390c34d7286a46c909e7189e3", + "70af681bab9841c983d625c6064b5947", + "4fa334d50b3f404096384c36e4889d63", + "28509e5d71474c888ae5542a1fbf37fe", + "01988eeeddc140faa9add4a96b609e33", + "8d90a5a3af304bc797c4468006e44eb6", + "b2a87bf15f584cc9b692d4f822239151", + "06ac586b88a44312a0863f8693464a8c", + "e455a19cefd34d3c8096b55e0db47ba7", + "7606bd660af0414a80078b82d35a0cc2", + "3dd327a297974dd6ab126d3fd1dcc250", + "76452981ed674b1abd97ed5451a76afd", + "c33de50287384adab8f62ef1b9a0917f", + "9a89d5f988014afd94b1d73de4b0633a", + "920ec347c09742dfb6c1217aebf2b168", + "df8ecb68af944327b6912e03fd343e98", + "2e36c543f1c64f3791d4caac8fd42ef3", + "f2085944b6974f7386ad1ecb7aaab039", + "20d96622e1f046a48e7f351298260d27", + "296d129263034380be801e051054df96", + "5796862e59de4c789658cae2e88a32fd", + "d70ff1b47ae04627843bfff486403e0e", + "da02ba6d7eed47e486e93a30e5997626", + "cddb71e762e14d2f820f6d46d1950d15", + "55811a18ddcc46718b6112ac2be24f2a" + ] + }, + "id": "B4SkVs-Myl1u", + "outputId": "4561150a-fc65-4d80-a04b-494404a56e42" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:89: UserWarning: \n", + "The secret `HF_TOKEN` does not exist in your Colab secrets.\n", + "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n", + "You will be able to reuse this secret in all of your notebooks.\n", + "Please note that authentication is recommended but still optional to access public models or datasets.\n", + " warnings.warn(\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "tokenizer_config.json: 0%| | 0.00/48.0 [00:00=2.27 in /usr/local/lib/python3.10/dist-packages (from gtts) (2.31.0)\n", + "Requirement already satisfied: click<8.2,>=7.1 in /usr/local/lib/python3.10/dist-packages (from gtts) (8.1.7)\n", + "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.15.4)\n", + "Requirement already satisfied: huggingface-hub<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.23.4)\n", + "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.25.2)\n", + "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (24.1)\n", + "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0.1)\n", + "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2024.5.15)\n", + "Requirement already satisfied: tokenizers<0.20,>=0.19 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.19.1)\n", + "Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.4.3)\n", + "Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch) (4.12.2)\n", + "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch) (1.12.1)\n", + "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch) (3.3)\n", + "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch) (3.1.4)\n", + "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch) (2023.6.0)\n", + "Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch) (12.1.105)\n", + "Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch) (12.1.105)\n", + "Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch) (12.1.105)\n", + "Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /usr/local/lib/python3.10/dist-packages (from torch) (8.9.2.26)\n", + "Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /usr/local/lib/python3.10/dist-packages (from torch) (12.1.3.1)\n", + "Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /usr/local/lib/python3.10/dist-packages (from torch) (11.0.2.54)\n", + "Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /usr/local/lib/python3.10/dist-packages (from torch) (10.3.2.106)\n", + "Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /usr/local/lib/python3.10/dist-packages (from torch) (11.4.5.107)\n", + "Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /usr/local/lib/python3.10/dist-packages (from torch) (12.1.0.106)\n", + "Requirement already satisfied: nvidia-nccl-cu12==2.20.5 in /usr/local/lib/python3.10/dist-packages (from torch) (2.20.5)\n", + "Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /usr/local/lib/python3.10/dist-packages (from torch) (12.1.105)\n", + "Requirement already satisfied: triton==2.3.0 in /usr/local/lib/python3.10/dist-packages (from torch) (2.3.0)\n", + "Requirement already satisfied: nvidia-nvjitlink-cu12 in /usr/local/lib/python3.10/dist-packages (from nvidia-cusolver-cu12==11.4.5.107->torch) (12.5.82)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (2.0.7)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.27->gtts) (2024.6.2)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch) (2.1.5)\n", + "Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from sympy->torch) (1.3.0)\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import torch\n", + "from torch.utils.data import DataLoader, Dataset\n", + "from transformers import DistilBertTokenizer, DistilBertForSequenceClassification, AdamW, get_linear_schedule_with_warmup\n", + "from sklearn.model_selection import train_test_split\n", + "from tqdm import tqdm\n", + "from pydub import AudioSegment\n", + "from pydub.playback import play\n", + "from gtts import gTTS\n", + "import openai\n", + "import os" + ], + "metadata": { + "id": "fRhejtLI0x7Y" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "from IPython.display import HTML, Audio\n", + "from google.colab.output import eval_js\n", + "from base64 import b64decode\n", + "import numpy as np\n", + "from scipy.io.wavfile import read as wav_read\n", + "import io\n", + "import ffmpeg\n", + "\n", + "AUDIO_HTML = \"\"\"\n", + "\n", + "\"\"\"\n", + "\n", + "def get_audio():\n", + " display(HTML(AUDIO_HTML))\n", + " data = eval_js(\"data\")\n", + " binary = b64decode(data.split(',')[1])\n", + "\n", + " process = (ffmpeg\n", + " .input('pipe:0')\n", + " .output('pipe:1', format='wav')\n", + " .run_async(pipe_stdin=True, pipe_stdout=True, pipe_stderr=True, quiet=True, overwrite_output=True)\n", + " )\n", + " output, err = process.communicate(input=binary)\n", + "\n", + " riff_chunk_size = len(output) - 8\n", + " # Break up the chunk size into four bytes, held in b.\n", + " q = riff_chunk_size\n", + " b = []\n", + " for i in range(4):\n", + " q, r = divmod(q, 256)\n", + " b.append(r)\n", + "\n", + " # Replace bytes 4:8 in proc.stdout with the actual size of the RIFF chunk.\n", + " riff = output[:4] + bytes(b) + output[8:]\n", + "\n", + " sr, audio = wav_read(io.BytesIO(riff))\n", + "\n", + " return audio, sr\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "import speech_recognition as sr\n", + "from gtts import gTTS\n", + "from pydub import AudioSegment\n", + "from pydub.playback import play\n", + "import pandas as pd\n", + "\n", + "\n", + "\n", + "# Answering questions\n", + "def answer_question(medicine_name, question, medicine_info):\n", + " medicine_name = medicine_name.lower().strip()\n", + " if medicine_name not in medicine_info:\n", + " return \"Medicine not found.\"\n", + "\n", + " info = medicine_info[medicine_name]\n", + " if \"use\" in question.lower():\n", + " return info.get('Uses', 'No information available.')\n", + " elif \"side effect\" in question.lower():\n", + " return info.get('Side_effects', 'No information available.')\n", + " else:\n", + " return \"I can only answer questions about uses and side effects.\"\n", + "\n", + "# Convert text to speech and save to file\n", + "def text_to_speech(text, filename=\"response.mp3\"):\n", + " tts = gTTS(text=text, lang='en')\n", + " tts.save(filename)\n", + " return filename\n", + "\n", + "\n", + "\n", + "\n", + "# Play audio function\n", + "def play_audio(audio_data, sample_rate):\n", + " display(Audio(data=audio_data, rate=sample_rate))\n", + "\n", + "\n", + "\n", + "\n", + "def speech_to_text(audio_data, sample_rate):\n", + " recognizer = sr.Recognizer()\n", + " audio_data = audio_data.astype('int16').tobytes()\n", + " audio_data_obj = sr.AudioData(audio_data, sample_rate=sample_rate, sample_width=2)\n", + "\n", + " try:\n", + " text = recognizer.recognize_google(audio_data_obj, language='en-US', show_all=False)\n", + " return text\n", + " except sr.UnknownValueError:\n", + " return \"Sorry, I could not understand the audio.\"\n", + " except sr.RequestError:\n", + " return \"Sorry, my speech recognition service is currently unavailable.\"\n", + "\n", + "sample_rate = 48000\n", + "# Example usage\n", + "if __name__ == \"__main__\":\n", + " # Convert all values in the 'Medicine Name' column to lowercase\n", + " data['Medicine Name'] = data['Medicine Name'].str.lower()\n", + "\n", + " # Convert the data to a dictionary\n", + " medicine_info = data.set_index('Medicine Name').T.to_dict()\n", + "\n", + " # Record user's question\n", + " medicine_name_aud, sr1 = get_audio()\n", + " question_text_aud, sr2= get_audio()\n", + "\n", + " # Get the answer from the chatbot\n", + " medicine_name = speech_to_text(medicine_name_aud, sample_rate=sample_rate) # Replace with appropriate medicine name\n", + " question_text = speech_to_text(question_text_aud, sample_rate=sample_rate)\n", + " print (f\"Medicine: {medicine_name}\")\n", + " print(f\"User Question: {question_text}\")\n", + " answer_text = answer_question(medicine_name, question_text, medicine_info)\n", + " print(f\"Chatbot Answer: {answer_text}\")\n", + "\n", + " # Convert the chatbot answer to speech\n", + " tts_output_file = text_to_speech(answer_text)\n", + " print(f\"Audio response saved to {tts_output_file}.\")\n", + "\n", + " # Play the audio response\n", + " play_audio(tts_output_file, sample_rate=sample_rate)\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 338 + }, + "id": "RaBjTO_TcccI", + "outputId": "2258d927-18c9-4dc3-def0-43a5d86d0bd2" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + ":178: UserWarning: DataFrame columns are not unique, some columns will be omitted.\n", + " medicine_info = data.set_index('Medicine Name').T.to_dict()\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + "\n" + ] + }, + "metadata": {} + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + "\n" + ] + }, + "metadata": {} + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Medicine: azithral 500 tablet\n", + "User Question: uses\n", + "Chatbot Answer: Treatment of Bacterial infections\n", + "Audio response saved to response.mp3.\n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + " \n", + " " + ] + }, + "metadata": {} + } + ] + }, + { + "cell_type": "code", + "source": [ + "data.head()" + ], + "metadata": { + "id": "q4Xs1bMto5ob", + "outputId": "873f6351-f80c-436a-e8fc-796fc20660bd", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 275 + } + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Medicine Name \\\n", + "0 Avastin 400mg Injection \n", + "1 Augmentin 625 Duo Tablet \n", + "2 Azithral 500 Tablet \n", + "3 Ascoril LS Syrup \n", + "4 Aciloc 150 Tablet \n", + "\n", + " Composition \\\n", + "0 Bevacizumab (400mg) \n", + "1 Amoxycillin (500mg) + Clavulanic Acid (125mg) \n", + "2 Azithromycin (500mg) \n", + "3 Ambroxol (30mg/5ml) + Levosalbutamol (1mg/5ml)... \n", + "4 Ranitidine (150mg) \n", + "\n", + " Uses \\\n", + "0 Cancer of colon and rectum Non-small cell lun... \n", + "1 Treatment of Bacterial infections \n", + "2 Treatment of Bacterial infections \n", + "3 Treatment of Cough with mucus \n", + "4 Treatment of Gastroesophageal reflux disease (... \n", + "\n", + " Side_effects \\\n", + "0 Rectal bleeding Taste change Headache Noseblee... \n", + "1 Vomiting Nausea Diarrhea Mucocutaneous candidi... \n", + "2 Nausea Abdominal pain Diarrhea \n", + "3 Nausea Vomiting Diarrhea Upset stomach Stomach... \n", + "4 Headache Diarrhea Gastrointestinal disturbance \n", + "\n", + " Manufacturer Label \n", + "0 Roche Products India Pvt Ltd 0 \n", + "1 Glaxo SmithKline Pharmaceuticals Ltd 0 \n", + "2 Alembic Pharmaceuticals Ltd 0 \n", + "3 Glenmark Pharmaceuticals Ltd 0 \n", + "4 Cadila Pharmaceuticals Ltd 0 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Medicine NameCompositionUsesSide_effectsManufacturerLabel
0Avastin 400mg InjectionBevacizumab (400mg)Cancer of colon and rectum Non-small cell lun...Rectal bleeding Taste change Headache Noseblee...Roche Products India Pvt Ltd0
1Augmentin 625 Duo TabletAmoxycillin (500mg) + Clavulanic Acid (125mg)Treatment of Bacterial infectionsVomiting Nausea Diarrhea Mucocutaneous candidi...Glaxo SmithKline Pharmaceuticals Ltd0
2Azithral 500 TabletAzithromycin (500mg)Treatment of Bacterial infectionsNausea Abdominal pain DiarrheaAlembic Pharmaceuticals Ltd0
3Ascoril LS SyrupAmbroxol (30mg/5ml) + Levosalbutamol (1mg/5ml)...Treatment of Cough with mucusNausea Vomiting Diarrhea Upset stomach Stomach...Glenmark Pharmaceuticals Ltd0
4Aciloc 150 TabletRanitidine (150mg)Treatment of Gastroesophageal reflux disease (...Headache Diarrhea Gastrointestinal disturbanceCadila Pharmaceuticals Ltd0
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "data", + "summary": "{\n \"name\": \"data\",\n \"rows\": 11825,\n \"fields\": [\n {\n \"column\": \"Medicine Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 11498,\n \"samples\": [\n \"Mixbiotic-AC Ear Drop\",\n \"Druffnil Shampoo\",\n \"Fungicip 150mg Tablet\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Composition\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 3358,\n \"samples\": [\n \"Blonanserin (4mg)\",\n \"Indomethacin (50mg)\",\n \"Metformin (1000mg) + Vildagliptin (50mg)\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Uses\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 712,\n \"samples\": [\n \" Hormone replacement therapy Post menopausal osteoporosis\",\n \"Treatment of Rheumatoid arthritisTreatment of PsoriasisTreatment of CancerTreatment of Crohn\\u2019s disease\",\n \"Treatment of Dandruff\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Side_effects\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1512,\n \"samples\": [\n \"Headache Loss of appetite Dizziness Weakness Joint pain Muscle pain\",\n \"Bone pain Weakness Headache Rash Nausea Increased lactate dehydrogenase level in blood Vomiting Increased uric acid level in blood Oropharyngeal pain Hair loss Fatigue Diarrhea Constipation Decreased appetite Cough Breathing problems Injection site reactions pain swelling redness\",\n \"Nausea Headache Bloating\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Manufacturer\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 759,\n \"samples\": [\n \"Jupiter Pharmaceutical Ltd\",\n \"Rivan Pharma\",\n \"Inga Laboratories Pvt Ltd\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Label\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0,\n \"min\": 0,\n \"max\": 0,\n \"num_unique_values\": 1,\n \"samples\": [\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "wHWgK6aKutOv" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file