MartinKosela commited on
Commit
e5dd67d
1 Parent(s): 824ef6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -27
app.py CHANGED
@@ -52,41 +52,31 @@ 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 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
 
65
  st.write("")
66
 
67
- st.markdown("<h4 style='font-size:20px;'>Outline Functionality of Your Application:</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)
86
- st.write("Explanation:", explanation)
87
- rating = st.slider("Rate the explanation from 1 (worst) to 5 (best):", 1, 5)
88
- feedback = st.text_input("Any additional feedback?")
89
- if st.button("Submit Feedback", key="submit_feedback_key"):
90
- st.session_state.feedback_submitted = True
91
- if st.session_state.feedback_submitted:
92
- st.success("Thank you for your feedback!")
 
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
 
59
  st.write("")
60
 
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
+ # Hardcoded 'Next' button that is always visible
65
+ if st.button("Next", key="next_to_dataset"):
66
+ st.session_state.show_dataset_description = True
 
 
 
67
 
68
+ if 'show_dataset_description' in st.session_state and st.session_state.show_dataset_description:
69
  st.markdown("<h4 style='font-size:20px;'>Detail Your Model's Training Dataset:</h4>", unsafe_allow_html=True)
70
  dataset_description = st.text_area("", key="dataset_description")
71
 
72
+ if st.button("Recommend AI Model", key="recommend_model_button"):
73
+ recommended_model = recommend_ai_model_via_gpt(description)
74
+ st.subheader(f"Recommended: {recommended_model}")
75
+ explanation = explain_recommendation(recommended_model)
76
+ st.write("Explanation:", explanation)
77
+ rating = st.slider("Rate the explanation from 1 (worst) to 5 (best):", 1, 5)
78
+ feedback = st.text_input("Any additional feedback?")
79
+ if st.button("Submit Feedback", key="submit_feedback_key"):
80
+ st.session_state.feedback_submitted = True
81
+ if st.session_state.feedback_submitted:
82
+ st.success("Thank you for your feedback!")