Spaces:
Runtime error
Runtime error
chore: apply Danni's corrections
Browse files
app.py
CHANGED
|
@@ -8,43 +8,49 @@ import itertools
|
|
| 8 |
nltk.download("punkt")
|
| 9 |
spell = SpellChecker()
|
| 10 |
|
| 11 |
-
st.
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
st.subheader("Start with typing your headline idea")
|
| 16 |
headline = st.text_input(
|
| 17 |
-
"",
|
| 18 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
)
|
| 20 |
|
| 21 |
-
st.
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# TODO
|
| 24 |
# """
|
| 25 |
# MVP
|
| 26 |
-
# - research "Why the story matters to a reader?" and subtitles
|
| 27 |
# - ask sources' authors for permission or rephrase (Nick appproved)
|
| 28 |
-
# - ask Danni for help (asked)
|
| 29 |
|
| 30 |
# Workshopping:
|
| 31 |
# - try to write a headline with that tool
|
| 32 |
-
# - fill help when possible, for types too
|
| 33 |
# - ask in Facebook/reddit group/privs Medium Wroters/bloggers for feedback!
|
| 34 |
-
# - own domain (hosting on Streamlit requires asking for extra capacity, 3 users is default)
|
| 35 |
|
| 36 |
# Features:
|
| 37 |
-
# - consider turning examplary headlines into links
|
| 38 |
# - bloom few shot for high-level guidelines
|
| 39 |
# - train paraphraser to specific types
|
| 40 |
# - BERT for suprise metric
|
| 41 |
|
| 42 |
-
# 1
|
| 43 |
-
st.subheader("
|
| 44 |
-
st.write("**Make sure your headline answers the
|
| 45 |
-
st.checkbox("What the story
|
| 46 |
st.checkbox(
|
| 47 |
-
"Why the story
|
| 48 |
) # TODO does examplary headlines really answer that? maybe in sub-headlines, I don't get it but looks important, read more
|
| 49 |
|
| 50 |
st.write("**Moreover:**")
|
|
@@ -98,13 +104,15 @@ st.checkbox(
|
|
| 98 |
|
| 99 |
# 2 Editorial guidelines DONE
|
| 100 |
st.subheader("Editorial Guidelines")
|
| 101 |
-
st.checkbox("Use Title Case (NEVER ALL CAPS)") # implement warning?
|
| 102 |
# alpha_chars = [c for c in headline if c.isalpha()]
|
| 103 |
# upper_chars = [c for c in alpha_chars if c.isupper()]
|
| 104 |
# upper_ratio = upper_chars / alpha_chars
|
| 105 |
# is_mostly_upper = upper_ratio > 0.8
|
| 106 |
# TODO show is_mostly_upper
|
| 107 |
|
|
|
|
|
|
|
| 108 |
st.checkbox("Fix typos") # red -> green, Spacy
|
| 109 |
# TODO try https://pypi.org/project/language-tool-python/
|
| 110 |
# if headline:
|
|
@@ -252,7 +260,7 @@ st.markdown(
|
|
| 252 |
)
|
| 253 |
|
| 254 |
st.write("**Quote**")
|
| 255 |
-
st.markdown("- Mom, Why Don’t You Have Any Black Friends?")
|
| 256 |
|
| 257 |
st.write("**Validate readers’ feelings**")
|
| 258 |
st.markdown(
|
|
@@ -284,12 +292,16 @@ st.markdown(
|
|
| 284 |
# 4 Actions DONE
|
| 285 |
st.subheader("Actions:")
|
| 286 |
st.checkbox(
|
| 287 |
-
"Share the headline with someone you trust and
|
| 288 |
)
|
| 289 |
st.checkbox("Give them a few options and tell them to make a choice")
|
| 290 |
st.checkbox(
|
| 291 |
"When published, look at what people are saying when they share the article"
|
| 292 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
|
| 294 |
# 5 Sources DONE
|
| 295 |
st.subheader("Sources:")
|
|
|
|
| 8 |
nltk.download("punkt")
|
| 9 |
spell = SpellChecker()
|
| 10 |
|
| 11 |
+
st.markdown(
|
| 12 |
+
"""
|
| 13 |
+
# How To Write a Headline on Medium
|
| 14 |
+
##### Guidelines turned into an interactive app
|
| 15 |
+
"""
|
| 16 |
+
)
|
| 17 |
+
st.write("")
|
| 18 |
+
st.write("")
|
| 19 |
+
st.write("")
|
| 20 |
|
|
|
|
| 21 |
headline = st.text_input(
|
| 22 |
+
"Start with typing your headline idea",
|
| 23 |
+
"How I Built My First Oak Coffee Table",
|
| 24 |
+
)
|
| 25 |
+
subheadline = st.text_input(
|
| 26 |
+
"and subheadline",
|
| 27 |
+
"Don't make these mistakes",
|
| 28 |
)
|
| 29 |
|
| 30 |
+
st.write("")
|
| 31 |
+
st.write("")
|
| 32 |
+
st.write("")
|
| 33 |
|
| 34 |
# TODO
|
| 35 |
# """
|
| 36 |
# MVP
|
|
|
|
| 37 |
# - ask sources' authors for permission or rephrase (Nick appproved)
|
|
|
|
| 38 |
|
| 39 |
# Workshopping:
|
| 40 |
# - try to write a headline with that tool
|
|
|
|
| 41 |
# - ask in Facebook/reddit group/privs Medium Wroters/bloggers for feedback!
|
|
|
|
| 42 |
|
| 43 |
# Features:
|
|
|
|
| 44 |
# - bloom few shot for high-level guidelines
|
| 45 |
# - train paraphraser to specific types
|
| 46 |
# - BERT for suprise metric
|
| 47 |
|
| 48 |
+
# 1 Primary guidelines
|
| 49 |
+
st.subheader("Primary Guidelines")
|
| 50 |
+
st.write("**Make sure your headline answers the following questions:**")
|
| 51 |
+
st.checkbox("What is the story about?")
|
| 52 |
st.checkbox(
|
| 53 |
+
"Why does the story matter to a reader?"
|
| 54 |
) # TODO does examplary headlines really answer that? maybe in sub-headlines, I don't get it but looks important, read more
|
| 55 |
|
| 56 |
st.write("**Moreover:**")
|
|
|
|
| 104 |
|
| 105 |
# 2 Editorial guidelines DONE
|
| 106 |
st.subheader("Editorial Guidelines")
|
| 107 |
+
st.checkbox("Use Title Case For The Headline (NEVER ALL CAPS)") # implement warning?
|
| 108 |
# alpha_chars = [c for c in headline if c.isalpha()]
|
| 109 |
# upper_chars = [c for c in alpha_chars if c.isupper()]
|
| 110 |
# upper_ratio = upper_chars / alpha_chars
|
| 111 |
# is_mostly_upper = upper_ratio > 0.8
|
| 112 |
# TODO show is_mostly_upper
|
| 113 |
|
| 114 |
+
st.checkbox("Use sentence case for the subheadline")
|
| 115 |
+
|
| 116 |
st.checkbox("Fix typos") # red -> green, Spacy
|
| 117 |
# TODO try https://pypi.org/project/language-tool-python/
|
| 118 |
# if headline:
|
|
|
|
| 260 |
)
|
| 261 |
|
| 262 |
st.write("**Quote**")
|
| 263 |
+
st.markdown("'- Mom, Why Don’t You Have Any Black Friends?'")
|
| 264 |
|
| 265 |
st.write("**Validate readers’ feelings**")
|
| 266 |
st.markdown(
|
|
|
|
| 292 |
# 4 Actions DONE
|
| 293 |
st.subheader("Actions:")
|
| 294 |
st.checkbox(
|
| 295 |
+
"Share the headline with someone you trust and ask them what they think the story is about"
|
| 296 |
)
|
| 297 |
st.checkbox("Give them a few options and tell them to make a choice")
|
| 298 |
st.checkbox(
|
| 299 |
"When published, look at what people are saying when they share the article"
|
| 300 |
)
|
| 301 |
+
st.checkbox("Format it properly:")
|
| 302 |
+
st.markdown(
|
| 303 |
+
"[Tips for Formatting Your Title and Headers](https://medium.com/creators-hub/tips-for-formatting-your-title-and-headers-1ff1a016ef75)"
|
| 304 |
+
)
|
| 305 |
|
| 306 |
# 5 Sources DONE
|
| 307 |
st.subheader("Sources:")
|