Update app2.py
Browse files
app2.py
CHANGED
|
@@ -4,51 +4,50 @@ import streamlit as st
|
|
| 4 |
def main():
|
| 5 |
st.title("Streamlit Options")
|
| 6 |
|
| 7 |
-
|
| 8 |
-
st.header("Text")
|
| 9 |
-
st.text("This is a text")
|
| 10 |
-
st.markdown("This is a markdown")
|
| 11 |
-
|
| 12 |
-
# Title
|
| 13 |
-
st.title("This is a title")
|
| 14 |
-
|
| 15 |
-
# Header
|
| 16 |
-
st.header("This is a header")
|
| 17 |
-
|
| 18 |
-
# Subheader
|
| 19 |
-
st.subheader("This is a subheader")
|
| 20 |
-
|
| 21 |
-
# Code
|
| 22 |
-
st.header("Code :")
|
| 23 |
-
st.code("import streamlit as st")
|
| 24 |
-
|
| 25 |
-
# Display Data
|
| 26 |
-
st.header("Write stm :")
|
| 27 |
-
st.write("This is a write statement")
|
| 28 |
-
|
| 29 |
-
# Dataframe
|
| 30 |
-
st.header("Dataframe")
|
| 31 |
-
import pandas as pd
|
| 32 |
-
df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
|
| 33 |
-
st.write(df)
|
| 34 |
-
|
| 35 |
-
# JSON
|
| 36 |
-
st.header("JSON:")
|
| 37 |
-
json_data = {"name": "John", "age": 30, "city": "New York"}
|
| 38 |
-
st.write(json_data)
|
| 39 |
-
|
| 40 |
-
# Checkbox
|
| 41 |
-
st.header("Checkbox:")
|
| 42 |
-
checkbox = st.checkbox("Checkbox")
|
| 43 |
-
if checkbox:
|
| 44 |
-
st.write("Checkbox is checked")
|
| 45 |
-
|
| 46 |
-
# Radio
|
| 47 |
st.header("Radio:")
|
| 48 |
-
radio = st.radio("Radio", ["
|
| 49 |
st.write("Selected option:", radio)
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
st.header("Select Box:")
|
| 53 |
selectbox = st.selectbox("Selectbox", ["Option 1", "Option 2", "Option 3"])
|
| 54 |
st.write("Selected option:", selectbox)
|
|
@@ -109,6 +108,6 @@ def main():
|
|
| 109 |
st.header("Color Picker :")
|
| 110 |
color_picker = st.color_picker("Color Picker")
|
| 111 |
st.write("Selected color:", color_picker)
|
| 112 |
-
|
| 113 |
if __name__ == "__main__":
|
| 114 |
main()
|
|
|
|
| 4 |
def main():
|
| 5 |
st.title("Streamlit Options")
|
| 6 |
|
| 7 |
+
# Radio
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
st.header("Radio:")
|
| 9 |
+
radio = st.radio("Radio", ["Open AI", "Gemini ", "TBD"])
|
| 10 |
st.write("Selected option:", radio)
|
| 11 |
+
|
| 12 |
+
If st.radio == "OpenAI"
|
| 13 |
+
{
|
| 14 |
+
rol = st.text_input("Enter Role")
|
| 15 |
+
st.write("Entered role:", rol)
|
| 16 |
+
#st.header("Slider:")
|
| 17 |
+
temp = st.slider("temperature", min_value=0.0, max_value=1, value=0.7, step=0.1)
|
| 18 |
+
st.write("Selected value:", temp)
|
| 19 |
+
|
| 20 |
+
from langchain_community.llms import OpenAI
|
| 21 |
+
|
| 22 |
+
def generate_linkedin_post(topic):
|
| 23 |
+
# Enhanced prompt with additional context for better post generation
|
| 24 |
+
prompt = (
|
| 25 |
+
f"Create a professional, engaging LinkedIn post about {topic}. "
|
| 26 |
+
"It should start with a attention grabbing hook based on audience pain"
|
| 27 |
+
"Then a line to agitate the user. This should be in the next line"
|
| 28 |
+
"The post should be concise, informative, and suitable for a professional audience. "
|
| 29 |
+
"It should provide value, insights, or thought-provoking content related to the topic. "
|
| 30 |
+
"And only contain 3 points."
|
| 31 |
+
"The tone should be positive and encouraging, suitable for networking and professional growth." )
|
| 32 |
+
llm = OpenAI(temperature=temp,role= rol, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
| 33 |
+
response = llm(prompt)
|
| 34 |
+
return response
|
| 35 |
+
|
| 36 |
+
with st.form("my_form"):
|
| 37 |
+
{
|
| 38 |
+
topic = st.text_area("Enter the topic for your LinkedIn post:")
|
| 39 |
+
submitted = st.form_submit_button("Generate Post")
|
| 40 |
+
if submitted and topic:
|
| 41 |
+
post = generate_linkedin_post(topic)
|
| 42 |
+
st.info(post)
|
| 43 |
+
elif submitted and not topic:
|
| 44 |
+
st.error("Please enter a topic to generate a post.")
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
}
|
| 50 |
+
"""" # Selectbox
|
| 51 |
st.header("Select Box:")
|
| 52 |
selectbox = st.selectbox("Selectbox", ["Option 1", "Option 2", "Option 3"])
|
| 53 |
st.write("Selected option:", selectbox)
|
|
|
|
| 108 |
st.header("Color Picker :")
|
| 109 |
color_picker = st.color_picker("Color Picker")
|
| 110 |
st.write("Selected color:", color_picker)
|
| 111 |
+
"""
|
| 112 |
if __name__ == "__main__":
|
| 113 |
main()
|