Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,55 +1,7 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import os
|
| 4 |
|
| 5 |
-
|
| 6 |
-
st.set_page_config(
|
| 7 |
-
page_title="AI LinkedIn Post Generator",
|
| 8 |
-
page_icon="💼",
|
| 9 |
-
layout="centered"
|
| 10 |
-
)
|
| 11 |
-
|
| 12 |
-
# ------------------ CUSTOM CSS ------------------
|
| 13 |
-
st.markdown("""
|
| 14 |
-
<style>
|
| 15 |
-
body {
|
| 16 |
-
background: linear-gradient(135deg, #4facfe, #00f2fe);
|
| 17 |
-
}
|
| 18 |
-
.main {
|
| 19 |
-
background-color: white;
|
| 20 |
-
padding: 25px;
|
| 21 |
-
border-radius: 15px;
|
| 22 |
-
}
|
| 23 |
-
h1, h2, h3 {
|
| 24 |
-
color: #1f2937;
|
| 25 |
-
font-weight: 800;
|
| 26 |
-
}
|
| 27 |
-
p, label {
|
| 28 |
-
color: #374151;
|
| 29 |
-
font-weight: 600;
|
| 30 |
-
font-size: 16px;
|
| 31 |
-
}
|
| 32 |
-
.stButton>button {
|
| 33 |
-
background-color: #2563eb;
|
| 34 |
-
color: white;
|
| 35 |
-
font-weight: bold;
|
| 36 |
-
border-radius: 8px;
|
| 37 |
-
padding: 10px;
|
| 38 |
-
}
|
| 39 |
-
.stTextInput>div>div>input, .stTextArea textarea {
|
| 40 |
-
background-color: #f9fafb;
|
| 41 |
-
color: black;
|
| 42 |
-
font-weight: 600;
|
| 43 |
-
}
|
| 44 |
-
</style>
|
| 45 |
-
""", unsafe_allow_html=True)
|
| 46 |
-
|
| 47 |
-
# ------------------ TITLE ------------------
|
| 48 |
-
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 |
-
api_key = os.getenv("GROQ_API_KEY")
|
| 53 |
|
| 54 |
if not api_key:
|
| 55 |
st.error("⚠️ API key not found! Add GROQ_API_KEY in Hugging Face Secrets.")
|
|
@@ -67,7 +19,7 @@ st.write("Create high-quality LinkedIn posts step-by-step 🚀")
|
|
| 67 |
"""
|
| 68 |
|
| 69 |
with st.spinner("Generating your post... ✨"):
|
| 70 |
-
|
| 71 |
response = client.chat.completions.create(
|
| 72 |
model="mixtral-8x7b-32768",
|
| 73 |
messages=[
|
|
|
|
| 1 |
+
# ------------------ GENERATE ------------------
|
| 2 |
+
elif st.session_state.step == 5:
|
|
|
|
| 3 |
|
| 4 |
+
api_key = os.getenv("GROQ_API_KEY")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
if not api_key:
|
| 7 |
st.error("⚠️ API key not found! Add GROQ_API_KEY in Hugging Face Secrets.")
|
|
|
|
| 19 |
"""
|
| 20 |
|
| 21 |
with st.spinner("Generating your post... ✨"):
|
| 22 |
+
try:
|
| 23 |
response = client.chat.completions.create(
|
| 24 |
model="mixtral-8x7b-32768",
|
| 25 |
messages=[
|