| import streamlit as st |
| from langchain_community.llms import OpenAI |
|
|
| def main(): |
| st.title("Open AI or Gemini Options") |
|
|
| |
| st.header("Radio:") |
| radio = st.radio("Radio", ["Open AI", "Gemini", "TBD"]) |
| st.write("Selected option:", radio) |
| |
| if radio == "Open AI": |
| role = st.text_input("Enter Role") |
| st.write("Entered role:", role) |
| |
| |
| st.header("Slider:") |
| temp = st.slider("Temperature", min_value=0.0, max_value=1.0, value=0.7, step=0.1) |
| st.write("Selected value:", temp) |
|
|
| def generate_linkedin_post(topic, role): |
| |
| prompt = ( |
| f" You as {role} Create a professional, engaging LinkedIn post about {topic}. " |
| "It should start with a attention grabbing hook based on audience pain. " |
| "Then a line to agitate the user. This should be in the next line. " |
| "The post should be concise, informative, and suitable for a professional audience. " |
| "It should provide value, insights, or thought-provoking content related to the topic. " |
| "And only contain 3 points. " |
| "The tone should be positive and encouraging, suitable for networking and professional growth." |
| ) |
| llm = OpenAI(temperature=temp, openai_api_key=st.secrets["OPENAI_API_KEY"]) |
| response = llm(prompt) |
| return response |
| |
| with st.form("my_form"): |
| topic = st.text_area("Enter the topic for your LinkedIn post:") |
| submitted = st.form_submit_button("Generate Post") |
| if submitted and topic: |
| post = generate_linkedin_post(topic) |
| st.info(post) |
| elif submitted and not topic: |
| st.error("Please enter a topic to generate a post.") |
|
|
| if __name__ == "__main__": |
| main() |
| |
| """" # Selectbox |
| st.header("Select Box:") |
| selectbox = st.selectbox("Selectbox", ["Option 1", "Option 2", "Option 3"]) |
| st.write("Selected option:", selectbox) |
| |
| # Multiselect |
| st.header("Multiselect Box:") |
| multiselect = st.multiselect("Multiselect", ["Option 1", "Option 2", "Option 3"]) |
| st.write("Selected options:", multiselect) |
| |
| # Slider |
| st.header("Slider:") |
| slider = st.slider("Slider", min_value=0, max_value=10, value=5, step=1) |
| st.write("Selected value:", slider) |
| |
| # Button |
| st.header("Button:") |
| |
| button = st.button("Button") |
| if button: |
| st.write("Button clicked") |
| |
| # Text Input |
| st.header("text_input :") |
| |
| text_input = st.text_input("Text Input") |
| st.write("Entered text:", text_input) |
| |
| # Text Area |
| st.header("text_Area :") |
| |
| text_area = st.text_area("Text Area") |
| st.write("Entered text:", text_area) |
| |
| # Number Input |
| st.header("Number input :") |
| |
| number_input = st.number_input("Number Input", min_value=0, max_value=100, value=50, step=1) |
| st.write("Entered number:", number_input) |
| |
| # File Uploader |
| st.header("File Uploader :") |
| |
| file_uploader = st.file_uploader("File Uploader", type=["txt", "csv"]) |
| if file_uploader is not None: |
| st.write("File uploaded") |
| |
| # Date Input |
| st.header("Date Input :") |
| date_input = st.date_input("Date Input") |
| st.write("Selected date:", date_input) |
| |
| # Time Input |
| st.header("Time Input :") |
| time_input = st.time_input("Time Input") |
| st.write("Selected time:", time_input) |
| |
| # Color Picker |
| st.header("Color Picker :") |
| color_picker = st.color_picker("Color Picker") |
| st.write("Selected color:", color_picker) |
| |
| if __name__ == "__main__": |
| main()""" |
|
|