MartinKosela commited on
Commit
78b9b43
·
1 Parent(s): bb49f02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -52,7 +52,13 @@ def explain_recommendation(model_name):
52
  response = openai.ChatCompletion.create(model="gpt-4", messages=messages)
53
  return response['choices'][0]['message']['content'].strip()
54
 
55
- # Streamlit UI
 
 
 
 
 
 
56
  st.image("./A8title.png")
57
  st.title('Discover the best model for your GenAI App')
58
 
@@ -61,19 +67,19 @@ st.write("")
61
  st.markdown("<h4 style='font-size:20px;'>Outline Your Application's Functionality:</h4>", unsafe_allow_html=True)
62
  description = st.text_area("", key="app_description")
63
 
64
- if description or 'next_clicked' in st.session_state:
65
- if st.button("Next step: Dataset", key="next_to_dataset"):
66
- st.session_state['next_clicked'] = True
 
 
67
  st.session_state.show_dataset_description = True
68
 
69
- if 'show_dataset_description' in st.session_state and st.session_state.show_dataset_description:
70
- st.write("")
71
- st.markdown("<h4 style='font-size:20px;'>Detail Your Training Dataset:</h4>", unsafe_allow_html=True)
72
  dataset_description = st.text_area("", key="dataset_description")
73
 
74
- if dataset_description or 'recommend_clicked' in st.session_state:
75
  if st.button("Recommend AI Model", key="recommend_model_button"):
76
- st.session_state['recommend_clicked'] = True
77
  recommended_model = recommend_ai_model_via_gpt(description)
78
  st.subheader(f"Recommended: {recommended_model}")
79
  explanation = explain_recommendation(recommended_model)
 
52
  response = openai.ChatCompletion.create(model="gpt-4", messages=messages)
53
  return response['choices'][0]['message']['content'].strip()
54
 
55
+ # Streamlit UI Initialization
56
+ if 'next_clicked' not in st.session_state:
57
+ st.session_state['next_clicked'] = False
58
+
59
+ if 'show_dataset_description' not in st.session_state:
60
+ st.session_state['show_dataset_description'] = False
61
+
62
  st.image("./A8title.png")
63
  st.title('Discover the best model for your GenAI App')
64
 
 
67
  st.markdown("<h4 style='font-size:20px;'>Outline Your Application's Functionality:</h4>", unsafe_allow_html=True)
68
  description = st.text_area("", key="app_description")
69
 
70
+ if description:
71
+ st.session_state['next_clicked'] = True
72
+
73
+ if st.session_state['next_clicked']:
74
+ if st.button("Next", key="next_to_dataset"):
75
  st.session_state.show_dataset_description = True
76
 
77
+ if st.session_state['show_dataset_description']:
78
+ st.markdown("<h4 style='font-size:20px;'>Detail Your Model's Training Dataset:</h4>", unsafe_allow_html=True)
 
79
  dataset_description = st.text_area("", key="dataset_description")
80
 
81
+ if dataset_description:
82
  if st.button("Recommend AI Model", key="recommend_model_button"):
 
83
  recommended_model = recommend_ai_model_via_gpt(description)
84
  st.subheader(f"Recommended: {recommended_model}")
85
  explanation = explain_recommendation(recommended_model)