nniehaus commited on
Commit
3bab3d6
·
verified ·
1 Parent(s): bb837d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -21
app.py CHANGED
@@ -2,36 +2,35 @@ import streamlit as st
2
  import openai
3
 
4
  def main():
5
- st.title("Engagement Ring Selector")
 
6
  openai.api_key = st.secrets["OPENAI_API_KEY"]
7
 
8
- fiancée_description = st.text_input("Describe your fiancée:", value="", placeholder="e.g., loves classic style, has a vibrant personality")
9
- relationship_details = st.text_area("Details about your relationship:", value="", placeholder="e.g., together for 3 years, love hiking and traveling")
10
- budget = st.selectbox("Select your budget range:", ['Under $1,000', '$1,000 - $3,000', '$3,000 - $5,000', 'Above $5,000'])
11
 
12
- if st.button('Generate Ring Suggestions'):
13
- response = generate_ring_suggestions(fiancée_description, relationship_details, budget)
14
  if response:
15
- st.subheader("Suggested Engagement Rings:")
16
  st.write(response)
17
  else:
18
- st.error("Failed to generate ring suggestions. Please check the inputs and try again.")
19
 
20
- def generate_ring_suggestions(fiancée_description, relationship_details, budget):
21
  try:
22
- prompt_text = f"""You are a world-class jewelry expert specializing in engagement rings. Based on the following information, provide 10 unique
23
- engagement ring suggestions that would perfectly suit the described fiancée and their relationship. Consider the style preferences, personality,
24
- and budget while making your suggestions. Include details about the ring's design, gemstone, metal, and any special features.
25
-
26
- Fiancée Description: {fiancée_description}
27
- Relationship Details: {relationship_details}
28
- Budget: {budget}
29
-
30
- Reply with a list of the best 10 engagement ring options."""
31
  response = openai.ChatCompletion.create(
32
- model="gpt-4o",
33
  messages=[{"role": "system", "content": prompt_text}],
34
- max_tokens=500
35
  )
36
  return response.choices[0].message['content']
37
  except Exception as e:
@@ -39,4 +38,4 @@ def generate_ring_suggestions(fiancée_description, relationship_details, budget
39
  return None
40
 
41
  if __name__ == "__main__":
42
- main()
 
2
  import openai
3
 
4
  def main():
5
+ st.title("Blog Post Idea and Outline Generator")
6
+
7
  openai.api_key = st.secrets["OPENAI_API_KEY"]
8
 
9
+ blog_topic = st.text_input("Enter your blog topic:", value="", placeholder="e.g., Artificial Intelligence in Healthcare")
10
+ target_audience = st.text_input("Describe your target audience:", value="", placeholder="e.g., healthcare professionals")
11
+ post_length = st.selectbox("Choose the length of your blog post:", ['Short (500 words)', 'Medium (1000 words)', 'Long (1500+ words)'])
12
 
13
+ if st.button('Generate Blog Post Ideas and Outlines'):
14
+ response = generate_blog_ideas_and_outlines(blog_topic, target_audience, post_length)
15
  if response:
16
+ st.subheader("Suggested Blog Post Ideas and Outlines:")
17
  st.write(response)
18
  else:
19
+ st.error("Failed to generate blog post ideas and outlines. Please check the inputs and try again.")
20
 
21
+ def generate_blog_ideas_and_outlines(topic, audience, length):
22
  try:
23
+ prompt_text = f"""As an expert content strategist and writer, create 5 unique blog post ideas on the topic of {topic} for {audience}. For each idea, provide a brief outline suitable for a {length} post. Each outline should include:
24
+ 1. An attention-grabbing title
25
+ 2. 3-5 main sections with brief descriptions
26
+ 3. A concluding thought or call-to-action
27
+
28
+ Ensure that each idea is distinct and tailored to the interests and needs of the target audience."""
29
+
 
 
30
  response = openai.ChatCompletion.create(
31
+ model="gpt-4",
32
  messages=[{"role": "system", "content": prompt_text}],
33
+ max_tokens=1000
34
  )
35
  return response.choices[0].message['content']
36
  except Exception as e:
 
38
  return None
39
 
40
  if __name__ == "__main__":
41
+ main()