Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- app (2).py +30 -0
- app3.py +36 -0
- app4.py +43 -0
- requirements.txt +5 -0
app (2).py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
#from langchain.llms import OpenAI
|
| 3 |
+
from langchain_community.llms import OpenAI
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
st.title("🔗 LinkedIn Post Generator")
|
| 7 |
+
|
| 8 |
+
def generate_linkedin_post(topic):
|
| 9 |
+
# Enhanced prompt with additional context for better post generation
|
| 10 |
+
prompt = (
|
| 11 |
+
f"Create a professional, engaging LinkedIn post about {topic}. "
|
| 12 |
+
"It should start with a attention grabbing hook based on audience pain"
|
| 13 |
+
"Then a line to agitate the user. This should be in the next line"
|
| 14 |
+
"The post should be concise, informative, and suitable for a professional audience. "
|
| 15 |
+
"It should provide value, insights, or thought-provoking content related to the topic. "
|
| 16 |
+
"And only contain 3 points."
|
| 17 |
+
"The tone should be positive and encouraging, suitable for networking and professional growth."
|
| 18 |
+
)
|
| 19 |
+
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
| 20 |
+
response = llm(prompt)
|
| 21 |
+
return response
|
| 22 |
+
|
| 23 |
+
with st.form("my_form"):
|
| 24 |
+
topic = st.text_area("Enter the topic for your LinkedIn post:")
|
| 25 |
+
submitted = st.form_submit_button("Generate Post")
|
| 26 |
+
if submitted and topic:
|
| 27 |
+
post = generate_linkedin_post(topic)
|
| 28 |
+
st.info(post)
|
| 29 |
+
elif submitted and not topic:
|
| 30 |
+
st.error("Please enter a topic to generate a post.")
|
app3.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#from langchain.llms import OpenAI
|
| 2 |
+
import streamlit as st
|
| 3 |
+
from langchain_community.llms import OpenAI
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
st.title("🔗 LinkedIn Test Post Generator two options")
|
| 7 |
+
|
| 8 |
+
def generate_linkedin_post(topic):
|
| 9 |
+
# Enhanced prompt with additional context for better post generation
|
| 10 |
+
prompt = (
|
| 11 |
+
f"Create a LinkedIn post about {topic} that grabs attention and makes people chuckle. Here's how:" +
|
| 12 |
+
f"Start with a relatable pain point:** Something the audience groans about inwardly (e.g., 'Ever spend hours on a task that should take minutes?')"+
|
| 13 |
+
f"Agitate with a pinch of absurdity:** Exaggerate the pain point in a slightly ridiculous way (e.g., '...only to discover your cat was sitting on the keyboard the whole time.')"+
|
| 14 |
+
f"***Offer a solution (with a twist):** Provide a real tip but phrase it unexpectedly (e.g., 'Turns out, the answer lies in [insightful tip] - and checking for rogue felines.')"+
|
| 15 |
+
f"***Tone:** Confident, slightly tongue-in-cheek. Aim for a knowing smile, not a belly laugh.")
|
| 16 |
+
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
| 17 |
+
response = llm(prompt)
|
| 18 |
+
return response
|
| 19 |
+
|
| 20 |
+
with st.form("my_form"):
|
| 21 |
+
topic = st.text_area("Enter the topic for your LinkedIn post:")
|
| 22 |
+
submitted = st.form_submit_button("Generate Post")
|
| 23 |
+
if submitted and topic:
|
| 24 |
+
post = generate_linkedin_post(topic)
|
| 25 |
+
st.info(post)
|
| 26 |
+
elif submitted and not topic:
|
| 27 |
+
st.error("Please enter a topic to generate a post.")
|
| 28 |
+
|
| 29 |
+
with st.form("my_form1"):
|
| 30 |
+
topic2 = st.text_area("Enter the topic 2 for your LinkedIn post:")
|
| 31 |
+
submitted2 = st.form_submit_button("Generate Post")
|
| 32 |
+
if submitted2 and topic2:
|
| 33 |
+
post = generate_linkedin_post(topic)
|
| 34 |
+
st.info(post)
|
| 35 |
+
elif submitted2 and not topic2:
|
| 36 |
+
st.error("Please enter a topic 2 to generate a post.")
|
app4.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from langchain_community.llms import OpenAI
|
| 3 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 4 |
+
st.set_page_config(layout="wide")
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# Function to handle AI invocation and response
|
| 8 |
+
def analyze_job_description(topic, model ):
|
| 9 |
+
prompt = (
|
| 10 |
+
f"As an HR Manager, I need you to analyze the following job description and identify the key technical skills, non technical skills or soft skills , further divide it nice-to-have skills, must-have skills, required for the role: {topic}. "
|
| 11 |
+
"The post should be concise, informative, and suitable for a professional audience. "
|
| 12 |
+
"List top 5 points for technical skills, nice-to-have skills, must-have skills, and soft skills required for the role."
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
if model == "Open AI":
|
| 16 |
+
# llm = OpenAI(openai_api_key=st.secrets["OPENAI_API_KEY"])
|
| 17 |
+
response ="Whoops! Looks like someone's got champagne tastes on a lemonade budget. How about we explore those other options for now? 😉"
|
| 18 |
+
return response
|
| 19 |
+
elif model == "Gemini":
|
| 20 |
+
llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
|
| 21 |
+
result = llm.invoke(prompt)
|
| 22 |
+
return result.content
|
| 23 |
+
|
| 24 |
+
def main():
|
| 25 |
+
st.title("JD Analysis")
|
| 26 |
+
# Radio selection for AI model
|
| 27 |
+
st.header("Select AI:")
|
| 28 |
+
model = st.radio("Model", [ "Gemini","Open AI",])
|
| 29 |
+
st.write("Selected option:", model)
|
| 30 |
+
|
| 31 |
+
# Text area for job description input
|
| 32 |
+
with st.form("my_form"):
|
| 33 |
+
topic = st.text_area("Copy Paste the JD here:")
|
| 34 |
+
submitted = st.form_submit_button("Analyze Now")
|
| 35 |
+
if submitted and topic:
|
| 36 |
+
result = analyze_job_description(topic, model )
|
| 37 |
+
st.info(result)
|
| 38 |
+
elif submitted and not topic:
|
| 39 |
+
st.error("Please enter a JD details to analyze.")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
if __name__ == "__main__":
|
| 43 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
langchain_community
|
| 3 |
+
requests
|
| 4 |
+
openai
|
| 5 |
+
langchain_google_genai
|