-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
34 lines (29 loc) · 939 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import streamlit as st
from utils import (
apply_custom_css,
get_user_input,
generate_response,
display_answer,
)
def main():
"""
Main function to run the MathGPT Streamlit app.
"""
# Set page configuration for mathematical theme
st.set_page_config(page_title="MathGPT-o1", page_icon="∑")
# Apply custom CSS for mathematical design
apply_custom_css()
# Get user input
api_key, query, selected_model = get_user_input()
if st.button("Get Answer ➤"):
if not api_key.strip():
st.warning("Please enter your OpenAI API key.")
elif not query.strip():
st.warning("Please enter a math query.")
else:
with st.spinner('🧮 Calculating...'):
answer = generate_response(api_key, query, selected_model)
if answer:
display_answer(answer)
if __name__ == "__main__":
main()