Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,7 @@ import os # Import the os module
|
|
| 5 |
# Fetch the API key from an environment variable
|
| 6 |
openai_api_key = os.getenv("OPENAI_API_KEY")
|
| 7 |
|
| 8 |
-
|
| 9 |
-
model_choice = st.selectbox('Choose a model:', ['gpt-4-turbo','gpt-3.5-turbo', 'gpt-3.5-turbo-0125','gpt-3.5-turbo-1106','gpt-3.5-turbo-0613','gpt-3.5-turbo-16k-0613','gpt-3.5-turbo-16k','gpt-4-turbo-2024-04-09','gpt-4-turbo-preview', 'gpt-4-0125-preview','gpt-4-1106-preview','gpt-4-0613'])
|
| 10 |
|
| 11 |
# Lecture du message système à partir d'un fichier texte
|
| 12 |
try:
|
|
@@ -39,9 +38,9 @@ if prompt:
|
|
| 39 |
st.chat_message("user").write(prompt)
|
| 40 |
|
| 41 |
# Use a spinner to indicate that the model is generating a response
|
| 42 |
-
with st.spinner('
|
| 43 |
client = OpenAI(api_key=openai_api_key)
|
| 44 |
-
response = client.chat.completions.create(model=
|
| 45 |
msg = response.choices[0].message.content
|
| 46 |
|
| 47 |
# Append and display the assistant's response
|
|
|
|
| 5 |
# Fetch the API key from an environment variable
|
| 6 |
openai_api_key = os.getenv("OPENAI_API_KEY")
|
| 7 |
|
| 8 |
+
|
|
|
|
| 9 |
|
| 10 |
# Lecture du message système à partir d'un fichier texte
|
| 11 |
try:
|
|
|
|
| 38 |
st.chat_message("user").write(prompt)
|
| 39 |
|
| 40 |
# Use a spinner to indicate that the model is generating a response
|
| 41 |
+
with st.spinner('M-LAI is Thinking...'):
|
| 42 |
client = OpenAI(api_key=openai_api_key)
|
| 43 |
+
response = client.chat.completions.create(model='gpt-4-turbo', messages=st.session_state.messages)
|
| 44 |
msg = response.choices[0].message.content
|
| 45 |
|
| 46 |
# Append and display the assistant's response
|