Spaces:
Sleeping
Sleeping
alphayomega
commited on
Commit
•
0b37f7d
1
Parent(s):
abe3e7a
Update app.py
Browse files
app.py
CHANGED
@@ -70,25 +70,11 @@ if "selected_model" not in st.session_state:
|
|
70 |
model_option = "mixtral-8x7b-32768"
|
71 |
max_tokens_range = 32768
|
72 |
|
73 |
-
#
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
"Choose a model:",
|
79 |
-
options=[model_option],
|
80 |
-
format_func=lambda x: "Mixtral-8x7b-Instruct-v0.1",
|
81 |
-
index=0, # Predeterminado al único modelo disponible
|
82 |
-
disabled=True # Desactivar la selección
|
83 |
-
)
|
84 |
-
max_tokens = st.slider(
|
85 |
-
"Max Tokens:",
|
86 |
-
min_value=512,
|
87 |
-
max_value=max_tokens_range,
|
88 |
-
value=min(32768, max_tokens_range),
|
89 |
-
step=512,
|
90 |
-
help=f"Adjust the maximum number of tokens (words) for the model's response. Max for selected model: {max_tokens_range}",
|
91 |
-
)
|
92 |
|
93 |
# Detectar cambio de modelo y limpiar historial de chat si el modelo ha cambiado
|
94 |
if st.session_state.selected_model != model_option:
|
@@ -136,7 +122,7 @@ if prompt := st.chat_input("Escribe tu mensaje aquí..."):
|
|
136 |
chat_completion = client.chat.completions.create(
|
137 |
model=model_option,
|
138 |
messages=messages_for_api,
|
139 |
-
max_tokens=
|
140 |
stream=True,
|
141 |
)
|
142 |
|
|
|
70 |
model_option = "mixtral-8x7b-32768"
|
71 |
max_tokens_range = 32768
|
72 |
|
73 |
+
# No mostrar la selección del modelo ni la barra de tokens
|
74 |
+
st.write(f"Modelo seleccionado: {models[model_option]['name']}")
|
75 |
+
|
76 |
+
# Inicializar el slider de tokens para siempre mostrar 32768
|
77 |
+
st.session_state.max_tokens = max_tokens_range
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
# Detectar cambio de modelo y limpiar historial de chat si el modelo ha cambiado
|
80 |
if st.session_state.selected_model != model_option:
|
|
|
122 |
chat_completion = client.chat.completions.create(
|
123 |
model=model_option,
|
124 |
messages=messages_for_api,
|
125 |
+
max_tokens=max_tokens_range,
|
126 |
stream=True,
|
127 |
)
|
128 |
|