Spaces:
Runtime error
Runtime error
adding rayan prompt
Browse files
app.py
CHANGED
@@ -502,12 +502,12 @@ if st.session_state.get('button') == True:
|
|
502 |
prefrence_variables=["charcter counts: "+str(x)+", Target Rate: "+str(y) for x,y in zip(chars,sel_var_values)]
|
503 |
prefrence_variables=['']+prefrence_variables
|
504 |
preference = st.selectbox(
|
505 |
-
'Please select your preferences',
|
506 |
prefrence_variables,
|
507 |
index=0
|
508 |
)
|
509 |
options = st.multiselect(
|
510 |
-
'Select
|
511 |
["Convey key message in fewer words",
|
512 |
"Rephrase sentences to be more concise",
|
513 |
"Remove unnecessary details/repetitions",
|
@@ -519,7 +519,7 @@ if st.session_state.get('button') == True:
|
|
519 |
None)
|
520 |
|
521 |
if st.button('Generate AI Recommended Email'):
|
522 |
-
if(preference
|
523 |
st.error('Please select your preferences.')
|
524 |
else:
|
525 |
stats_col1, stats_col2, stats_col3, stats_col4 = st.columns([1, 1, 1, 1])
|
@@ -539,7 +539,8 @@ if st.session_state.get('button') == True:
|
|
539 |
st.markdown('{}'.format(ai_generated_email),unsafe_allow_html=True)
|
540 |
else:
|
541 |
email_body_opt=email_body
|
542 |
-
if(preference):
|
|
|
543 |
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
544 |
email_body_opt=ai_generated_email
|
545 |
optimized_email, optimized_char_cnt, optimized_url_cnt = optimize_email_prompt_multi(email_body_opt, options)
|
|
|
502 |
prefrence_variables=["charcter counts: "+str(x)+", Target Rate: "+str(y) for x,y in zip(chars,sel_var_values)]
|
503 |
prefrence_variables=['']+prefrence_variables
|
504 |
preference = st.selectbox(
|
505 |
+
'Please select your preferences for target metric',
|
506 |
prefrence_variables,
|
507 |
index=0
|
508 |
)
|
509 |
options = st.multiselect(
|
510 |
+
'Select prompts you want to use to generate your email:',
|
511 |
["Convey key message in fewer words",
|
512 |
"Rephrase sentences to be more concise",
|
513 |
"Remove unnecessary details/repetitions",
|
|
|
519 |
None)
|
520 |
|
521 |
if st.button('Generate AI Recommended Email'):
|
522 |
+
if(preference=='' and options is None):
|
523 |
st.error('Please select your preferences.')
|
524 |
else:
|
525 |
stats_col1, stats_col2, stats_col3, stats_col4 = st.columns([1, 1, 1, 1])
|
|
|
539 |
st.markdown('{}'.format(ai_generated_email),unsafe_allow_html=True)
|
540 |
else:
|
541 |
email_body_opt=email_body
|
542 |
+
if(preference is not ''):
|
543 |
+
st.markdown('##### preference is selected')
|
544 |
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
545 |
email_body_opt=ai_generated_email
|
546 |
optimized_email, optimized_char_cnt, optimized_url_cnt = optimize_email_prompt_multi(email_body_opt, options)
|