Skip to content

Commit

Permalink
Created structure for web app + added nbdev
Browse files Browse the repository at this point in the history
  • Loading branch information
namitasshah committed Mar 31, 2024
1 parent 1cce889 commit 9361c2d
Show file tree
Hide file tree
Showing 11 changed files with 987 additions and 0 deletions.
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ dependencies:
- python=3.11
- tiktoken
- langchain
- ipywidgets
- pandas
- fastcore=1.5.28
- jupyterlab
- ipykernel
- jupyter
- voila
- notebook
- sortedcontainers
- pip
- pip:
- langchain-openai
203 changes: 203 additions & 0 deletions nbs/JunkDrafts/junk1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "bc8b7226-7b0c-482a-a20a-e18f8b96cf07",
"metadata": {},
"outputs": [],
"source": [
"import dashboard\n",
"import pprint\n",
"# import matplotlib.pyplot as plt\n",
"import ipywidgets as widgets\n",
"from IPython.display import display, clear_output, HTML\n",
"from ipywidgets import Output, Tab\n",
"from pprint import pformat\n",
"import pandas as pd\n",
"\n",
"from fastcore.basics import patch\n",
"# import matplotlib.pyplot as plt\n",
"from IPython.display import display, clear_output, HTML\n",
"from ipywidgets import Output\n",
"from pprint import pformat\n",
"import pandas as pd\n",
"#from ipydatagrid import DataGrid\n",
"from ipywidgets import Tab"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "774a5039-0238-4eab-9727-ab7f73932c25",
"metadata": {},
"outputs": [],
"source": [
"accordion_welcome = widgets.Accordion(children=[\n",
" widgets.HTML(\"AI for Education\")\n",
"])\n",
"\n",
"accordion_welcome.set_title(0, 'Welcome!')\n",
"accordion_welcome.selected_index = 0\n",
"\n",
"next_tab_button = widgets.Button(description=\"Next\")\n",
"# next_tab_button.on_click(switch_to_next_tab)\n",
"\n",
"# Create Welcome tab content with accordion widgets\n",
"welcome_tab_content = widgets.VBox([\n",
" accordion_welcome,\n",
" next_tab_button\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ceca90d1-4f19-4627-90f8-da97fd164b8f",
"metadata": {},
"outputs": [],
"source": [
"tabs = widgets.Tab(children=[welcome_tab_content])\n",
"tabs.set_title(0, 'Welcome')\n",
"\n",
"# Create a label for the title with big, bold, and centered style\n",
"title_label = widgets.HTML(\n",
" value = \"<h2>Network Graph</h2>\"\n",
" #style={'font-size': '24px', 'font-weight': 'bold', 'text-align': 'center', 'margin-bottom': '10px'}\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "171cbe79-3ecb-4d16-b407-aa5341e7fd57",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e15e502ff7d54eaeb2ff5c95bf3347b0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Tab(children=(VBox(children=(Accordion(children=(HTML(value='AI for Education'),), selected_ind…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Display the widgets\n",
"display(widgets.VBox([tabs]))"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "ed34cb8d-623e-4903-941b-fbb072574602",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "963310e40dbd4db29a1944180f5c7393",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Tab(children=(Output(), Output(), Output(), Output()), selected_index=0, titles=('LogIn', 'User Profile', 'Cou…"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from ipywidgets import Tab, Output, Button\n",
"\n",
"# Create a Tab widget with two Output widgets as children\n",
"tab = Tab()\n",
"tab.children = [Output(), Output(), Output(), Output()] # Example content, can be any widget\n",
"tab.titles = ('LogIn', 'User Profile', 'Course Overview', 'Test/Assn Generator') # Set titles for the tabs (optional)\n",
"\n",
"next_tab_button = widgets.Button(description=\"Next\")\n",
"\n",
"\n",
"# Display the Tab widget\n",
"tab"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "dcda1aec-547c-45e5-807a-d9f60a41d4af",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0efbd9ba3e544aeea4e2fc641ff6a43a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(description='Click me!', style=ButtonStyle())"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from ipywidgets import Button\n",
"\n",
"# Create a button widget\n",
"button = Button(description='Click me!')\n",
"\n",
"# Display the button widget\n",
"button\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26db1cc9-c205-49a8-a4f8-3d8698726c32",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "f35a052d-2791-4c4c-987e-54c6a263f204",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
115 changes: 115 additions & 0 deletions nbs/firstTab.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"id": "543f060f-5d9b-4b76-9354-f8483575b468",
"metadata": {},
"outputs": [],
"source": [
"#| default_exp firstTab\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "112bc93b-c8cb-4576-87e9-045e953979d0",
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"import ipywidgets as widgets\n",
"from ipywidgets import Tab, Output, Button\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "7a9ea954-5bcd-4871-87a6-fe01fc3590f3",
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"class FirstTab(widgets.VBox):\n",
" \n",
" def __init__(self):\n",
" # If you forget to call the superconstructor on an extended widget\n",
" # you will get an AttributeError: object has no attribute '_model_id'\n",
" super().__init__()\n",
" \n",
" # Using Accordion\n",
" # Create accordion containing HTML content\n",
" self.using_acc = widgets.Accordion()\n",
" # self.using_acc.set_title(0, 'Using this App')\n",
" USING_TEXT = '''\n",
" In the Data tab above, you can review the dataset.\n",
" In the Selection tab, you can search for and download data of interest.\n",
" Once you've selected data, generate plots in the Visualize tab.\n",
" '''\n",
" self.using_body = widgets.HTML(USING_TEXT)\n",
" self.using_acc.children = (self.using_body, )\n",
" \n",
" # Data Souces Accordion\n",
" # Create accordion containing HTML content\n",
" self.sources_acc = widgets.Accordion()\n",
" # self.sources_acc.set_title(0, 'Data Sources')\n",
" SOURCES_TEXT = '''\n",
" Land-Ocean Temperature Index\n",
" Global Temperature (NASA)\n",
" ,\n",
" GISS Surface Temperature Analysis (NASA)\n",
" \n",
" This site is based on data downloaded from the following site on 2020-07-14:\n",
" Global Mean Estimates based on Land_and Ocean Data (NASA)\n",
" '''\n",
" self.sources_body = widgets.HTML(SOURCES_TEXT)\n",
" self.sources_acc.children = (self.sources_body, )\n",
"\n",
" self.next_button = Button(description='Next')\n",
" \n",
" self.children = (self.using_acc, self.sources_acc, self.next_button)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8ffe56dd-b8e8-43e2-9adf-c0e2531504c1",
"metadata": {},
"outputs": [],
"source": [
"from nbdev.export import nb_export\n",
"nb_export('firstTab.ipynb', 'nbdevFolder')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2a71b3eb-3d78-473b-8991-e2251a7c09ed",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 9361c2d

Please sign in to comment.