bizvideoschool
commited on
Commit
•
75ef369
1
Parent(s):
50fc87a
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import os
|
|
5 |
# Ensure your OpenAI API key is set in your environment variables
|
6 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
7 |
|
8 |
-
initial_messages = [{"role": "system", "content": """You are an AI assistant that helps
|
9 |
|
10 |
def call_openai_api(messages):
|
11 |
return openai.ChatCompletion.create(
|
@@ -20,16 +20,19 @@ def CustomChatGPT(user_input, messages):
|
|
20 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
21 |
return ChatGPT_reply, messages
|
22 |
|
23 |
-
st.title("
|
24 |
-
st.write("This tool
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
30 |
|
31 |
if submit_button:
|
32 |
messages = initial_messages.copy()
|
33 |
-
user_input = f"
|
34 |
reply, _ = CustomChatGPT(user_input, messages)
|
35 |
st.write(reply)
|
|
|
5 |
# Ensure your OpenAI API key is set in your environment variables
|
6 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
7 |
|
8 |
+
initial_messages = [{"role": "system", "content": """You are an AI assistant that helps users find the perfect engagement ring for their fiance. You'll gather information about their budget, metal preference, carat size, job of the fiance, and whether they prefer a simple or elaborate design. Provide recommendations for engagement rings that match these criteria."""}]
|
9 |
|
10 |
def call_openai_api(messages):
|
11 |
return openai.ChatCompletion.create(
|
|
|
20 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
21 |
return ChatGPT_reply, messages
|
22 |
|
23 |
+
st.title("Engagement Ring Finder")
|
24 |
+
st.write("This tool helps you find the perfect engagement ring for your fiance. Enter your budget, preferred metal, desired carat size, the job of your fiance, and whether you're looking for something simple or elaborate.")
|
25 |
|
26 |
+
budget = st.text_input("Budget", placeholder="Enter your budget for the ring.")
|
27 |
+
metal_preference = st.text_input("Metal Preference", placeholder="Enter your preferred metal (e.g., gold, platinum).")
|
28 |
+
carat_size = st.text_input("Carat Size", placeholder="Enter the desired carat size.")
|
29 |
+
fiance_job = st.text_input("Fiance's Job", placeholder="Enter your fiance's job (e.g., teacher, engineer).")
|
30 |
+
design_preference = st.selectbox("Design Preference", ["Simple", "Elaborate"])
|
31 |
+
|
32 |
+
submit_button = st.button('Find Rings')
|
33 |
|
34 |
if submit_button:
|
35 |
messages = initial_messages.copy()
|
36 |
+
user_input = f"My budget for the engagement ring is {budget}. I prefer {metal_preference} as the metal. I am looking for a ring with a carat size of {carat_size}. My fiance's job is {fiance_job} and I'm looking for a {design_preference.lower()} design."
|
37 |
reply, _ = CustomChatGPT(user_input, messages)
|
38 |
st.write(reply)
|