0o7Hunk commited on
Commit
1a552a8
Β·
verified Β·
1 Parent(s): cb2a05c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -105,7 +105,8 @@ elif st.session_state.step == 5:
105
 
106
  with st.spinner("Generating your post... ✨"):
107
 
108
- response = client.chat.completions.create(
 
109
  model="mixtral-8x7b-32768",
110
  messages=[
111
  {"role": "user", "content": user_input}
@@ -113,19 +114,14 @@ elif st.session_state.step == 5:
113
  max_tokens=500
114
  )
115
 
116
- # βœ… Extract response properly
117
  post = response.choices[0].message.content
118
 
119
- # βœ… Show success
120
  st.success("βœ… Your LinkedIn Post is Ready!")
121
-
122
- # βœ… Display output
123
  st.markdown("### πŸ“’ Generated Post")
124
  st.write(post)
125
 
126
- # βœ… Reset button
127
  if st.button("πŸ”„ Create Another"):
128
  st.session_state.step = 1
129
 
130
- except Exception as e:
131
  st.error(f"Error: {str(e)}")
 
105
 
106
  with st.spinner("Generating your post... ✨"):
107
 
108
+ try:
109
+ response = client.chat.completions.create(
110
  model="mixtral-8x7b-32768",
111
  messages=[
112
  {"role": "user", "content": user_input}
 
114
  max_tokens=500
115
  )
116
 
 
117
  post = response.choices[0].message.content
118
 
 
119
  st.success("βœ… Your LinkedIn Post is Ready!")
 
 
120
  st.markdown("### πŸ“’ Generated Post")
121
  st.write(post)
122
 
 
123
  if st.button("πŸ”„ Create Another"):
124
  st.session_state.step = 1
125
 
126
+ except Exception as e:
127
  st.error(f"Error: {str(e)}")