Spaces:
Sleeping
Sleeping
import streamlit as st | |
from post_generator import * | |
# Options for length and language | |
length_options = ["Short", "Medium", "Long", "Extra Long"] | |
language_options = ["English", "Hinglish"] | |
def main(): | |
st.title("🕵️ LinkedIn Content Generator") | |
st.markdown( | |
"""<style> | |
.css-1oe6wy4, .css-1y4p8pa { | |
background-color: #f8f9fa; | |
border-radius: 15px; | |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | |
} | |
.css-1v0mbdj { | |
background-color: #ffffff; | |
padding: 20px; | |
border-radius: 10px; | |
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); | |
} | |
</style> | |
""", | |
unsafe_allow_html=True, | |
) | |
st.markdown("**The code replicates the writing style of the selected author and generates posts accordingly. You can customize the raw data to match any author of your choice.**") | |
st.markdown("**Using meta models via Groq API and Prompt Engineering**") | |
st.markdown("---") | |
# ---- SIDEBAR FOR LLM MODEL SELECTION ---- | |
st.sidebar.header("LLM Settings") | |
llm_options = [ | |
"llama-3.3-70b-versatile", | |
"llama-3.2-1b-preview", | |
"llama-3.2-3b-preview", | |
"llama-3.3-70b-specdec", | |
"llama-3.1-8b-instant", | |
"llama-guard-3-8b", | |
"llama3-70b-8192", | |
"llama3-8b-8192" | |
] | |
selected_llm = st.sidebar.selectbox("Select LLM", options=llm_options) | |
# ---- CHOOSE POST PARAMETERS ---- | |
st.header("Choose Post Parameters") | |
fs = FewShotPosts() | |
tags = fs.get_tags() | |
# 1) Topic Selector | |
selected_tag = st.selectbox("Select a Topic", options=tags) | |
# 2) Additional Knowledge (Tile Below Topic) | |
# This text area will feed extra context to the LLM about the selected topic | |
st.subheader("Add Additional Knowledge") | |
additional_context = st.text_area( | |
"Enter any extra details or knowledge about the topic that the model should consider.", | |
placeholder="e.g., special data points, new trends, or context you want to include..." | |
) | |
# 3) Length and Language | |
col1, col2 = st.columns([1, 1]) | |
with col1: | |
selected_length = st.selectbox("Select Length", options=length_options) | |
with col2: | |
selected_language = st.selectbox("Select Language", options=language_options) | |
st.markdown("---") | |
st.header("Generate Post") | |
# Generate Button and Display | |
if st.button("Generate"): | |
# Pass additional_context into generate_post | |
post = generate_post( | |
length=selected_length, | |
language=selected_language, | |
tag=selected_tag, | |
model_name=selected_llm, | |
custom_context=additional_context | |
) | |
st.write(post) | |
else: | |
st.write("Click the button above to generate a LinkedIn post.") | |
st.markdown("---") | |
if __name__ == "__main__": | |
main() | |