Katherine commited on
Commit
f4cadd8
·
1 Parent(s): 277731f

app.py impl

Browse files
Files changed (2) hide show
  1. app.py +5 -1
  2. chatbot_development.ipynb +45 -8
app.py CHANGED
@@ -60,7 +60,11 @@ def create_chatbot():
60
  - Return that response as a string
61
  """
62
  # TODO: Generate and return response
63
- pass
 
 
 
 
64
 
65
 
66
 
 
60
  - Return that response as a string
61
  """
62
  # TODO: Generate and return response
63
+ try:
64
+ response = chatbot.get_response(message)
65
+ return response
66
+ except Exception as e:
67
+ return f"Sorry, something went wrong: {str(e)}"
68
 
69
 
70
 
chatbot_development.ipynb CHANGED
@@ -18,7 +18,7 @@
18
  },
19
  {
20
  "cell_type": "code",
21
- "execution_count": 18,
22
  "metadata": {},
23
  "outputs": [],
24
  "source": [
@@ -32,9 +32,24 @@
32
  },
33
  {
34
  "cell_type": "code",
35
- "execution_count": null,
36
  "metadata": {},
37
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  "source": [
39
  "\"\"\"\n",
40
  "TODO: Add your Hugging Face token\n",
@@ -57,7 +72,7 @@
57
  },
58
  {
59
  "cell_type": "code",
60
- "execution_count": 14,
61
  "metadata": {},
62
  "outputs": [],
63
  "source": [
@@ -69,9 +84,31 @@
69
  },
70
  {
71
  "cell_type": "code",
72
- "execution_count": null,
73
  "metadata": {},
74
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  "source": [
76
  "\"\"\"\n",
77
  "Test out generating some responses from the chatbot.\n",
@@ -102,7 +139,7 @@
102
  ],
103
  "metadata": {
104
  "kernelspec": {
105
- "display_name": "venv",
106
  "language": "python",
107
  "name": "python3"
108
  },
@@ -116,7 +153,7 @@
116
  "name": "python",
117
  "nbconvert_exporter": "python",
118
  "pygments_lexer": "ipython3",
119
- "version": "3.9.12"
120
  }
121
  },
122
  "nbformat": 4,
 
18
  },
19
  {
20
  "cell_type": "code",
21
+ "execution_count": 1,
22
  "metadata": {},
23
  "outputs": [],
24
  "source": [
 
32
  },
33
  {
34
  "cell_type": "code",
35
+ "execution_count": 6,
36
  "metadata": {},
37
+ "outputs": [
38
+ {
39
+ "data": {
40
+ "application/vnd.jupyter.widget-view+json": {
41
+ "model_id": "50617a1a9bdc434d9b897a5e9b529b52",
42
+ "version_major": 2,
43
+ "version_minor": 0
44
+ },
45
+ "text/plain": [
46
+ "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
47
+ ]
48
+ },
49
+ "metadata": {},
50
+ "output_type": "display_data"
51
+ }
52
+ ],
53
  "source": [
54
  "\"\"\"\n",
55
  "TODO: Add your Hugging Face token\n",
 
72
  },
73
  {
74
  "cell_type": "code",
75
+ "execution_count": 7,
76
  "metadata": {},
77
  "outputs": [],
78
  "source": [
 
84
  },
85
  {
86
  "cell_type": "code",
87
+ "execution_count": 8,
88
  "metadata": {},
89
+ "outputs": [
90
+ {
91
+ "name": "stdout",
92
+ "output_type": "stream",
93
+ "text": [
94
+ "\n",
95
+ "Question: I live in Jamaica Plain and want to send my child to a school that offers Spanish classes. What schools are available?\n",
96
+ "Response: There are several Boston Public Schools in and around Jamaica Plain that offer Spanish language instruction. Here are some options:\n",
97
+ "\n",
98
+ "1. Joseph P. Kelly Elementary School: This school offers Spanish bilingual education for students in grades Pre-K through 5. It is located at 1200 Columbus Ave, Boston, MA 02130.\n",
99
+ "\n",
100
+ "2. Edwin M. Bacon Elementary School: This school offers Spanish language instruction in grades Pre-K through 6. It is located at 30 Fayette St, Boston, MA 02130.\n",
101
+ "\n",
102
+ "3. Samuel J. & Dorothy Donnelly Elementary School: This school offers a Spanish Dual Language Learning Program in grades Pre-K through 5. It is located at 524 Cummins Highway, Roxbury, MA 02119.\n",
103
+ "\n",
104
+ "4. James Otis Elementary School: This school offers a Spanish Bilingual Program in grades Pre-K through 6. It is located at 1234 Columbus Ave, Boston, MA 02120.\n",
105
+ "\n",
106
+ "5. The John D. O'Bryant School of Mathematics and Science: This middle school (grades 6-8) offers Spanish language instruction as part of its academic program. It is located at 1345 Tremont St, Roxbury, MA 02120.\n",
107
+ "\n",
108
+ "It's recommended that you contact these schools directly to learn more about their programs and enrollment processes. Good luck!\n"
109
+ ]
110
+ }
111
+ ],
112
  "source": [
113
  "\"\"\"\n",
114
  "Test out generating some responses from the chatbot.\n",
 
139
  ],
140
  "metadata": {
141
  "kernelspec": {
142
+ "display_name": ".venv",
143
  "language": "python",
144
  "name": "python3"
145
  },
 
153
  "name": "python",
154
  "nbconvert_exporter": "python",
155
  "pygments_lexer": "ipython3",
156
+ "version": "3.12.2"
157
  }
158
  },
159
  "nbformat": 4,