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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -105,20 +105,27 @@ 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}
112
  ],
113
  max_tokens=500
114
  )
115
-
116
- st.write(response.choices[0].message.content)
117
 
118
- st.success("βœ… Your LinkedIn Post is Ready!")
 
119
 
120
- st.markdown("### πŸ“’ Generated Post")
121
- st.write(post)
122
 
123
- if st.button("πŸ”„ Create Another"):
124
- st.session_state.step = 1
 
 
 
 
 
 
 
 
 
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}
112
  ],
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)}")