Spaces:
Running
Running
samiee2213
commited on
Commit
•
df3c808
1
Parent(s):
415f65d
Update app.py
Browse files
app.py
CHANGED
@@ -21,8 +21,6 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
21 |
# Load environment variables
|
22 |
load_dotenv()
|
23 |
st.set_page_config(page_title="MindMate", layout="wide", initial_sidebar_state="expanded")
|
24 |
-
api_key = os.getenv('GEMINI_API_KEY')
|
25 |
-
|
26 |
|
27 |
# CSS styles
|
28 |
css = '''
|
@@ -435,8 +433,42 @@ def sidebar():
|
|
435 |
)
|
436 |
|
437 |
# API Key and Model Selection
|
438 |
-
st.
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
return selected_page.split(" ", 1)[1]
|
442 |
|
@@ -1200,7 +1232,7 @@ elif page == "How to use?":
|
|
1200 |
</div>
|
1201 |
<div class="section">
|
1202 |
<h3>🛠️ Tools:</h3>
|
1203 |
-
<ul>
|
1204 |
<li>Interactive exercises based on cognitive-behavioral therapy.</li>
|
1205 |
<li>Use these tools to solve problems, set goals, and more.</li>
|
1206 |
</ul>
|
|
|
21 |
# Load environment variables
|
22 |
load_dotenv()
|
23 |
st.set_page_config(page_title="MindMate", layout="wide", initial_sidebar_state="expanded")
|
|
|
|
|
24 |
|
25 |
# CSS styles
|
26 |
css = '''
|
|
|
433 |
)
|
434 |
|
435 |
# API Key and Model Selection
|
436 |
+
st.sidebar.subheader('Select Model')
|
437 |
+
models = ['3.5 Turbo', '4.0', 'Azure', 'Gemini', 'Ollama', 'Mistral'] # Example list of models
|
438 |
+
selected_model = st.sidebar.selectbox('Select Model', models)
|
439 |
+
|
440 |
+
api_key = st.sidebar.text_input('Enter API Key', type='password')
|
441 |
+
|
442 |
+
if selected_model == 'Azure':
|
443 |
+
endpoint = st.sidebar.text_input("Enter endpoint", type="url")
|
444 |
+
deployment_name = st.sidebar.text_input("Enter deployment name")
|
445 |
+
|
446 |
+
if st.sidebar.button('Run Model'):
|
447 |
+
st.session_state['api_key'] = api_key
|
448 |
+
|
449 |
+
if selected_model == '3.5 Turbo':
|
450 |
+
st.session_state['chat'] = ChatOpenAI(temperature=0, model="gpt-3.5-turbo", api_key=api_key)
|
451 |
+
elif selected_model == 'Azure':
|
452 |
+
st.session_state['chat'] = AzureChatOpenAI(
|
453 |
+
azure_endpoint=endpoint,
|
454 |
+
deployment_name=deployment_name,
|
455 |
+
openai_api_version="2023-03-15-preview",
|
456 |
+
api_key=api_key,
|
457 |
+
openai_api_type="Azure"
|
458 |
+
)
|
459 |
+
elif selected_model == '4.0':
|
460 |
+
st.session_state['chat'] = ChatOpenAI(temperature=0, model="gpt-4.0", api_key=api_key)
|
461 |
+
elif selected_model == 'Gemini':
|
462 |
+
st.session_state['chat'] = ChatGoogleGenerativeAI(model="gemini-1.5-pro",temperature=0,api_key=api_key,convert_system_message_to_human=True)
|
463 |
+
elif selected_model == 'Ollama':
|
464 |
+
st.session_state['chat'] = ChatOpenAI(temperature=0, model="ollama-1", api_key=api_key)
|
465 |
+
elif selected_model == 'Mistral':
|
466 |
+
st.session_state['chat'] = ChatOpenAI(temperature=0, model="mistral-1", api_key=api_key)
|
467 |
+
else:
|
468 |
+
st.error('Invalid model selection')
|
469 |
+
return
|
470 |
+
|
471 |
+
st.success(f'Model {selected_model} is running...')
|
472 |
|
473 |
return selected_page.split(" ", 1)[1]
|
474 |
|
|
|
1232 |
</div>
|
1233 |
<div class="section">
|
1234 |
<h3>🛠️ Tools:</h3>
|
1235 |
+
<ul>
|
1236 |
<li>Interactive exercises based on cognitive-behavioral therapy.</li>
|
1237 |
<li>Use these tools to solve problems, set goals, and more.</li>
|
1238 |
</ul>
|