Spaces:
Runtime error
Runtime error
adding rayan prompt
Browse files
app.py
CHANGED
|
@@ -487,14 +487,7 @@ if st.session_state.get('button') == True:
|
|
| 487 |
prefrence_variables,
|
| 488 |
index=1
|
| 489 |
)
|
| 490 |
-
|
| 491 |
-
if(preference is None):
|
| 492 |
-
st.error('Please upload a email (HTML format)')
|
| 493 |
-
else:
|
| 494 |
-
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
| 495 |
-
st.markdown('##### Here is the recommended Generated Email for you:')
|
| 496 |
-
st.markdown('{}:'.format(ai_generated_email),unsafe_allow_html=True)
|
| 497 |
-
options = st.multiselect(
|
| 498 |
'Select propmts you want to use to generate your email:',
|
| 499 |
["Convey key message in fewer words",
|
| 500 |
"Rephrase sentences to be more concise",
|
|
@@ -504,12 +497,22 @@ if st.session_state.get('button') == True:
|
|
| 504 |
"Link to information instead of writing it out",
|
| 505 |
"Shorten the subject line",
|
| 506 |
"Replace technical terms with simpler language"],
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
st.
|
| 512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
|
| 514 |
# st.session_state['button'] = False
|
| 515 |
# preference= "character counts: "+str(573)+", Target Rate: "+str(37.2)
|
|
|
|
| 487 |
prefrence_variables,
|
| 488 |
index=1
|
| 489 |
)
|
| 490 |
+
options = st.multiselect(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
'Select propmts you want to use to generate your email:',
|
| 492 |
["Convey key message in fewer words",
|
| 493 |
"Rephrase sentences to be more concise",
|
|
|
|
| 497 |
"Link to information instead of writing it out",
|
| 498 |
"Shorten the subject line",
|
| 499 |
"Replace technical terms with simpler language"],
|
| 500 |
+
None)
|
| 501 |
+
|
| 502 |
+
if st.button('Generate AI Recommended Email'):
|
| 503 |
+
if(preference is None):
|
| 504 |
+
st.error('Please upload a email (HTML format)')
|
| 505 |
+
else:
|
| 506 |
+
if(options==None):
|
| 507 |
+
ai_generated_email=generate_example_email_with_context(email_body, campaign, industry, target, sorted_chars_out, preference)
|
| 508 |
+
st.markdown('##### Here is the recommended Generated Email for you:')
|
| 509 |
+
st.markdown('{}:'.format(ai_generated_email),unsafe_allow_html=True)
|
| 510 |
+
else:
|
| 511 |
+
optimized_email, optimized_char_cnt, optimized_url_cnt = optimize_email_prompt_multi(email_body, options)
|
| 512 |
+
charc, tmval=get_optimized_prediction("sagemakermodelcc", "modelCC.sav", "sagemakermodelcc", target, industry,
|
| 513 |
+
optimized_char_cnt, optimized_url_cnt, industry_code_dict)
|
| 514 |
+
st.markdown('##### Current Character Count in Your Optimized Email is: {}'.format(charc), unsafe_allow_html=True)
|
| 515 |
+
st.markdown('##### The model predicts that it achieves a {} of {}%'.format(target,tmval), unsafe_allow_html=True)
|
| 516 |
|
| 517 |
# st.session_state['button'] = False
|
| 518 |
# preference= "character counts: "+str(573)+", Target Rate: "+str(37.2)
|