Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,12 @@ import os
|
|
4 |
|
5 |
# Get OpenAI API key from Secrets
|
6 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
7 |
-
#st.secrets["OPENAI_API_KEY"]
|
8 |
-
#os.environ.get('OPENAI_API_KEY')
|
9 |
|
10 |
# Define function to generate response to email
|
11 |
def generate_response(email_text):
|
12 |
# Create prompt
|
13 |
-
prompt = f"I am sharing an email with you. Please generate a response to this email
|
|
|
14 |
|
15 |
# Generate response
|
16 |
response = openai.Completion.create(
|
@@ -19,7 +18,7 @@ def generate_response(email_text):
|
|
19 |
max_tokens=1024,
|
20 |
n=1,
|
21 |
stop=None,
|
22 |
-
temperature=0.
|
23 |
# Add additional parameters here, such as prompt_id, file, or codify
|
24 |
)
|
25 |
|
@@ -32,7 +31,6 @@ st.title("Email Response Generator")
|
|
32 |
# Input email text
|
33 |
email_text = st.text_area("Enter email text", height = 200)
|
34 |
|
35 |
-
|
36 |
# Generate response
|
37 |
if email_text:
|
38 |
response = generate_response(email_text)
|
|
|
4 |
|
5 |
# Get OpenAI API key from Secrets
|
6 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
|
|
|
|
7 |
|
8 |
# Define function to generate response to email
|
9 |
def generate_response(email_text):
|
10 |
# Create prompt
|
11 |
+
prompt = f"""I am sharing an email with you. Please generate a response to this email
|
12 |
+
and be flattering of the sender.\n\n{email_text}\n\nYour response: """
|
13 |
|
14 |
# Generate response
|
15 |
response = openai.Completion.create(
|
|
|
18 |
max_tokens=1024,
|
19 |
n=1,
|
20 |
stop=None,
|
21 |
+
temperature=0.4
|
22 |
# Add additional parameters here, such as prompt_id, file, or codify
|
23 |
)
|
24 |
|
|
|
31 |
# Input email text
|
32 |
email_text = st.text_area("Enter email text", height = 200)
|
33 |
|
|
|
34 |
# Generate response
|
35 |
if email_text:
|
36 |
response = generate_response(email_text)
|