Skip to content

Commit 8b28708

Browse files
committed
chatbot: use the MODELS constant list of models in all versions - except the last
1 parent 77d50eb commit 8b28708

File tree

11 files changed

+92
-44
lines changed

11 files changed

+92
-44
lines changed
3 Bytes
Binary file not shown.

notebooks/tps/chatbot/chatbot-01.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
]
3030

3131

32-
# a hardwired list of models
32+
# a hardwired list of models
3333
MODELS = [
3434
"gemma2:2b",
3535
"mistral:7b",
@@ -58,7 +58,7 @@ def show_current_settings(_event):
5858
model = ft.Dropdown(
5959
options=[ft.dropdown.Option(model) for model in MODELS],
6060
value=MODELS[0],
61-
width=100,
61+
width=300,
6262
)
6363
server = ft.Dropdown(
6464
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-02.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
]
2525

2626

27+
# a hardwired list of models
28+
MODELS = [
29+
"gemma2:2b",
30+
"mistral:7b",
31+
]
32+
33+
2734
TITLE = "My first Chatbot"
2835

2936

@@ -44,9 +51,9 @@ def show_current_settings(_event):
4451

4552
streaming = ft.Checkbox(label="streaming", value=False)
4653
model = ft.Dropdown(
47-
options=[ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")],
48-
value="llama2",
49-
width=100,
54+
options=[ft.dropdown.Option(model) for model in MODELS],
55+
value=MODELS[0],
56+
width=300,
5057
)
5158
server = ft.Dropdown(
5259
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-03.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
]
2727

2828

29+
# a hardwired list of models
30+
MODELS = [
31+
"gemma2:2b",
32+
"mistral:7b",
33+
]
34+
35+
2936
TITLE = "My first Chatbot"
3037

3138

@@ -38,11 +45,9 @@ def __init__(self):
3845

3946
self.streaming = ft.Checkbox(label="streaming", value=False)
4047
self.model = ft.Dropdown(
41-
options=[
42-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
43-
],
44-
value="llama2",
45-
width=100,
48+
options=[ft.dropdown.Option(model) for model in MODELS],
49+
value=MODELS[0],
50+
width=300,
4651
)
4752
self.server = ft.Dropdown(
4853
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-04.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
]
2424

2525

26+
# a hardwired list of models
27+
MODELS = [
28+
"gemma2:2b",
29+
"mistral:7b",
30+
]
31+
32+
2633
TITLE = "My first Chatbot"
2734

2835

@@ -53,11 +60,9 @@ def __init__(self):
5360

5461
self.streaming = ft.Checkbox(label="streaming", value=False)
5562
self.model = ft.Dropdown(
56-
options=[
57-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
58-
],
59-
value="llama2",
60-
width=100,
63+
options=[ft.dropdown.Option(model) for model in MODELS],
64+
value=MODELS[0],
65+
width=300,
6166
)
6267
self.server = ft.Dropdown(
6368
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-05.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
]
2727

2828

29+
# a hardwired list of models
30+
MODELS = [
31+
"gemma2:2b",
32+
"mistral:7b",
33+
]
34+
35+
2936
TITLE = "My first Chatbot"
3037

3138

@@ -71,11 +78,9 @@ def __init__(self):
7178

7279
self.streaming = ft.Checkbox(label="streaming", value=False)
7380
self.model = ft.Dropdown(
74-
options=[
75-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
76-
],
77-
value="llama2",
78-
width=100,
81+
options=[ft.dropdown.Option(model) for model in MODELS],
82+
value=MODELS[0],
83+
width=300,
7984
)
8085
self.server = ft.Dropdown(
8186
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-06.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
]
3131

3232

33+
# a hardwired list of models
34+
MODELS = [
35+
"gemma2:2b",
36+
"mistral:7b",
37+
]
38+
39+
3340
TITLE = "My first Chatbot"
3441

3542

@@ -81,11 +88,9 @@ def __init__(self, page):
8188

8289
self.streaming = ft.Checkbox(label="streaming", value=False)
8390
self.model = ft.Dropdown(
84-
options=[
85-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
86-
],
87-
value="llama2",
88-
width=100,
91+
options=[ft.dropdown.Option(model) for model in MODELS],
92+
value=MODELS[0],
93+
width=300,
8994
)
9095
self.server = ft.Dropdown(
9196
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-07.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
]
3030

3131

32+
# a hardwired list of models
33+
MODELS = [
34+
"gemma2:2b",
35+
"mistral:7b",
36+
]
37+
38+
3239
TITLE = "My first Chatbot"
3340

3441

@@ -85,11 +92,9 @@ def __init__(self, page):
8592

8693
self.streaming = ft.Checkbox(label="streaming", value=False)
8794
self.model = ft.Dropdown(
88-
options=[
89-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
90-
],
91-
value="llama2",
92-
width=100,
95+
options=[ft.dropdown.Option(model) for model in MODELS],
96+
value=MODELS[0],
97+
width=300,
9398
)
9499
self.server = ft.Dropdown(
95100
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-08.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
]
2828

2929

30+
# a hardwired list of models
31+
MODELS = [
32+
"gemma2:2b",
33+
"mistral:7b",
34+
]
35+
36+
3037
TITLE = "My first Chatbot"
3138

3239

@@ -83,11 +90,9 @@ def __init__(self, page):
8390

8491
self.streaming = ft.Checkbox(label="streaming", value=False)
8592
self.model = ft.Dropdown(
86-
options=[
87-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
88-
],
89-
value="llama2",
90-
width=100,
93+
options=[ft.dropdown.Option(model) for model in MODELS],
94+
value=MODELS[0],
95+
width=300,
9196
)
9297
self.server = ft.Dropdown(
9398
options=[ft.dropdown.Option(server) for server in ("CPU", "GPU")],

notebooks/tps/chatbot/chatbot-09.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
]
3131

3232

33+
# a hardwired list of models
34+
MODELS = [
35+
"gemma2:2b",
36+
"mistral:7b",
37+
]
38+
39+
3340
TITLE = "My first Chatbot"
3441

3542

@@ -87,11 +94,9 @@ def __init__(self, page):
8794

8895
self.streaming = ft.Checkbox(label="streaming", value=True)
8996
self.model = ft.Dropdown(
90-
options=[
91-
ft.dropdown.Option(model) for model in ("llama2", "mistral", "gemma")
92-
],
93-
value="llama2",
94-
width=100,
97+
options=[ft.dropdown.Option(model) for model in MODELS],
98+
value=MODELS[0],
99+
width=300,
95100
)
96101
servernames = [s['name'] for s in SERVERS]
97102
self.server = ft.Dropdown(

0 commit comments

Comments
 (0)