Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ st.title("💼 AI LinkedIn Post Generator")
|
|
| 49 |
st.write("Create high-quality LinkedIn posts step-by-step 🚀")
|
| 50 |
|
| 51 |
# ------------------ LOAD API KEY FROM ENV ------------------
|
| 52 |
-
|
| 53 |
|
| 54 |
# ------------------ SESSION STATE ------------------
|
| 55 |
if "step" not in st.session_state:
|
|
@@ -105,12 +105,18 @@ elif st.session_state.step == 5:
|
|
| 105 |
|
| 106 |
with st.spinner("Generating your post... ✨"):
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
post = response.choices[0].message.content
|
| 115 |
|
| 116 |
st.success("✅ Your LinkedIn Post is Ready!")
|
|
|
|
| 49 |
st.write("Create high-quality LinkedIn posts step-by-step 🚀")
|
| 50 |
|
| 51 |
# ------------------ LOAD API KEY FROM ENV ------------------
|
| 52 |
+
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
| 53 |
|
| 54 |
# ------------------ SESSION STATE ------------------
|
| 55 |
if "step" not in st.session_state:
|
|
|
|
| 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 |
+
except Exception as e:
|
| 119 |
+
st.error(f"Error: {str(e)}")
|
| 120 |
post = response.choices[0].message.content
|
| 121 |
|
| 122 |
st.success("✅ Your LinkedIn Post is Ready!")
|