Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ presets = {
|
|
19 |
}
|
20 |
|
21 |
# Fixed system message
|
22 |
-
SYSTEM_MESSAGE = "Lake 1 Base"
|
23 |
|
24 |
def respond(
|
25 |
message,
|
@@ -71,12 +71,18 @@ pseudonyms = [model[1] for model in model_choices]
|
|
71 |
def respond_with_pseudonym(
|
72 |
message,
|
73 |
history: list,
|
74 |
-
|
75 |
selected_preset
|
76 |
):
|
|
|
|
|
|
|
77 |
# Find the actual model name from the pseudonym
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
# Call the existing respond function
|
81 |
response = respond(message, history, model_name, selected_preset)
|
82 |
|
@@ -86,8 +92,9 @@ def respond_with_pseudonym(
|
|
86 |
demo = gr.ChatInterface(
|
87 |
fn=respond_with_pseudonym,
|
88 |
additional_inputs=[
|
89 |
-
gr.Dropdown(choices=
|
90 |
-
gr.Dropdown(choices=
|
|
|
91 |
],
|
92 |
)
|
93 |
|
|
|
19 |
}
|
20 |
|
21 |
# Fixed system message
|
22 |
+
SYSTEM_MESSAGE = "Your name is Lake 1 Base but my is User"
|
23 |
|
24 |
def respond(
|
25 |
message,
|
|
|
71 |
def respond_with_pseudonym(
|
72 |
message,
|
73 |
history: list,
|
74 |
+
selected_model, # Change this to selected_model
|
75 |
selected_preset
|
76 |
):
|
77 |
+
print(f"Selected Model: {selected_model}") # Debugging line
|
78 |
+
print(f"Available Models: {pseudonyms}") # Debugging line
|
79 |
+
|
80 |
# Find the actual model name from the pseudonym
|
81 |
+
try:
|
82 |
+
model_name = next(model[0] for model in model_choices if model[1] == selected_model)
|
83 |
+
except StopIteration:
|
84 |
+
return f"Error: The selected model '{selected_model}' is not valid. Please select a valid model."
|
85 |
+
|
86 |
# Call the existing respond function
|
87 |
response = respond(message, history, model_name, selected_preset)
|
88 |
|
|
|
92 |
demo = gr.ChatInterface(
|
93 |
fn=respond_with_pseudonym,
|
94 |
additional_inputs=[
|
95 |
+
gr.Dropdown(choices=pseudonyms, label="Select Model", value=pseudonyms[0]), # Pseudonym selection dropdown
|
96 |
+
gr.Dropdown(choices=list(presets["mistralai/Mistral-7B-Instruct-v0.3"].keys()), label="Select Preset", value="Fast") # Preset selection dropdown
|
97 |
+
|
98 |
],
|
99 |
)
|
100 |
|