Spaces:
Runtime error
Runtime error
adding rayan prompt
Browse files
app.py
CHANGED
@@ -518,8 +518,8 @@ if st.session_state.get('button') == True:
|
|
518 |
None)
|
519 |
|
520 |
if st.button('Generate AI Recommended Email'):
|
521 |
-
if(preference is None):
|
522 |
-
st.error('Please
|
523 |
else:
|
524 |
stats_col1, stats_col2, stats_col3, stats_col4 = st.columns([1, 1, 1, 1])
|
525 |
with stats_col1:
|
@@ -531,11 +531,17 @@ if st.session_state.get('button') == True:
|
|
531 |
with stats_col4:
|
532 |
st.caption("Industry: Email")
|
533 |
if(options==None):
|
534 |
-
|
535 |
-
|
536 |
-
|
|
|
537 |
else:
|
538 |
-
|
|
|
|
|
|
|
|
|
|
|
539 |
charc, tmval=get_optimized_prediction("sagemakermodelcc", "modelCC.sav", "sagemakermodelcc", target, industry,
|
540 |
optimized_char_cnt, optimized_url_cnt, industry_code_dict)
|
541 |
st.markdown('##### Current Character Count in Your Optimized Email is: {}'.format(charc), unsafe_allow_html=True)
|
|
|
518 |
None)
|
519 |
|
520 |
if st.button('Generate AI Recommended Email'):
|
521 |
+
if(preference is None and options is None):
|
522 |
+
st.error('Please select your preferences.')
|
523 |
else:
|
524 |
stats_col1, stats_col2, stats_col3, stats_col4 = st.columns([1, 1, 1, 1])
|
525 |
with stats_col1:
|
|
|
531 |
with stats_col4:
|
532 |
st.caption("Industry: Email")
|
533 |
if(options==None):
|
534 |
+
if(preference):
|
535 |
+
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
536 |
+
st.markdown('##### Here is the recommended Generated Email for you:')
|
537 |
+
st.markdown('{}:'.format(ai_generated_email),unsafe_allow_html=True)
|
538 |
else:
|
539 |
+
if(preference):
|
540 |
+
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
541 |
+
email_body_opt=ai_generated_email
|
542 |
+
else:
|
543 |
+
email_body_opt=email_body
|
544 |
+
optimized_email, optimized_char_cnt, optimized_url_cnt = optimize_email_prompt_multi(email_body_opt, options)
|
545 |
charc, tmval=get_optimized_prediction("sagemakermodelcc", "modelCC.sav", "sagemakermodelcc", target, industry,
|
546 |
optimized_char_cnt, optimized_url_cnt, industry_code_dict)
|
547 |
st.markdown('##### Current Character Count in Your Optimized Email is: {}'.format(charc), unsafe_allow_html=True)
|