-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Jupyter4Science/jupyter-mentor
- Loading branch information
Showing
14 changed files
with
1,300 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/chatbot.ipynb. | ||
|
||
# %% auto 0 | ||
__all__ = ['ChatBot'] | ||
|
||
# %% ../nbs/chatbot.ipynb 1 | ||
import ipywidgets as widgets | ||
from ipywidgets import Textarea, Text, Layout, HBox | ||
|
||
# %% ../nbs/chatbot.ipynb 2 | ||
class ChatBot(widgets.VBox): | ||
|
||
def __init__(self): | ||
# If you forget to call the superconstructor on an extended widget | ||
# you will get an AttributeError: object has no attribute '_model_id' | ||
super().__init__() | ||
|
||
example_convo = ''' | ||
User: Hello, bot! | ||
Bot: Hi there! How can I assist you today? | ||
User: I need help setting up my email account. Can you guide me through the process? | ||
Bot: Of course! Could you please provide me with the email service provider you're using? | ||
User: I use Gmail. | ||
Bot: Great! First, go to the Gmail website and click on the "Create account" button. | ||
User: Okay, I'm there. What's next? | ||
Bot: Enter your personal information such as your name, desired email address, password, and recovery information. | ||
User: Done! What's next? | ||
Bot: Follow the prompts to verify your phone number and agree to the terms of service. | ||
User: All set! Thank you for your help, bot! | ||
Bot: You're welcome! If you have any more questions, feel free to ask. | ||
''' | ||
self.chat = Textarea( | ||
disabled = True, | ||
value = example_convo, | ||
layout=Layout(width='90%', height='400px') | ||
) | ||
self.user_input_and_submit = HBox() | ||
self.user_input = widgets.Text( | ||
placeholder='Message AI chatbot...', | ||
#layout=Layout(width='100%') | ||
) | ||
self.submit = widgets.ToggleButton( | ||
value=False, | ||
disabled=False, | ||
button_style='success', | ||
icon='arrow-circle-right' | ||
) | ||
self.user_input_and_submit.children = (self.user_input, self.submit) | ||
|
||
self.suggestion_buttons = HBox() | ||
self.step_by_step = widgets.Button( | ||
description='Step-by-Step', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.metaphor = widgets.Button( | ||
description='Metaphor', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.hints = widgets.Button( | ||
description='Hints', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.guided_questions = widgets.Button( | ||
description='AI Guided Questions', | ||
button_style='info', | ||
tooltip='Description', | ||
) | ||
self.suggestion_buttons.children = (self.step_by_step, self.metaphor, self.hints, self.guided_questions) | ||
self.children = (self.chat, self.suggestion_buttons, self.user_input_and_submit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/educator_model.ipynb. | ||
|
||
# %% auto 0 | ||
__all__ = ['EducatorModel'] | ||
|
||
# %% ../nbs/educator_model.ipynb 2 | ||
import traitlets | ||
from traitlets import HasTraits | ||
|
||
# %% ../nbs/educator_model.ipynb 3 | ||
class EducatorModel(HasTraits): | ||
|
||
user = traitlets.CUnicode() | ||
response = traitlets.CUnicode() | ||
|
||
def __init__(self): | ||
super().__init__() | ||
|
||
def invoke(self, prompt): | ||
# Goal: use langchain invoke and use the return value to update the self.response variable | ||
self.response = "Hi am an AI and I have a response" # TODO: edit this line so the response comes from langchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.