Spaces:
Runtime error
Runtime error
adding gen ai support
Browse files
app.py
CHANGED
@@ -505,10 +505,14 @@ if st.button('Generate Predictions'):
|
|
505 |
prefrence_variables,
|
506 |
index=1
|
507 |
)
|
508 |
-
if(preference):
|
509 |
-
|
510 |
-
|
511 |
-
|
|
|
|
|
|
|
|
|
512 |
|
513 |
|
514 |
# chars_out = dict(zip(chars, sel_var_values))
|
|
|
505 |
prefrence_variables,
|
506 |
index=1
|
507 |
)
|
508 |
+
# if(preference):
|
509 |
+
if st.button('Generate AI Recommended Email'):
|
510 |
+
if(preference is None):
|
511 |
+
st.error('Please upload a email (HTML format)')
|
512 |
+
else:
|
513 |
+
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
514 |
+
st.markdown('##### Here is the recommended Generated Email for you:')
|
515 |
+
st.markdown('####### {}:'.format(ai_generated_email),unsafe_allow_html=True)
|
516 |
|
517 |
|
518 |
# chars_out = dict(zip(chars, sel_var_values))
|
utils.py
CHANGED
@@ -2,6 +2,8 @@ import openai
|
|
2 |
from io import BytesIO
|
3 |
from config import config
|
4 |
|
|
|
|
|
5 |
|
6 |
def ask_chat_gpt(prompt, model=config.OPENAI_MODEL_TYPE, temp=0, max_tokens=500):
|
7 |
response = openai.Completion.create(
|
|
|
2 |
from io import BytesIO
|
3 |
from config import config
|
4 |
|
5 |
+
openai.api_key = config.OPEN_API_KEY
|
6 |
+
|
7 |
|
8 |
def ask_chat_gpt(prompt, model=config.OPENAI_MODEL_TYPE, temp=0, max_tokens=500):
|
9 |
response = openai.Completion.create(
|