Adding default text
Browse files
app.py
CHANGED
|
@@ -23,6 +23,22 @@ Easily create and edit your blog posts with our intuitive text editor. Use the b
|
|
| 23 |
Happy blogging!
|
| 24 |
"""
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Functions to append snippets at the end of the text
|
| 27 |
def append_snippet1(text):
|
| 28 |
return text + snippet1
|
|
@@ -38,11 +54,11 @@ def preview_text(text):
|
|
| 38 |
return text
|
| 39 |
|
| 40 |
with gr.Blocks() as demo:
|
| 41 |
-
gr.Markdown()
|
| 42 |
|
| 43 |
with gr.Row():
|
| 44 |
with gr.Column():
|
| 45 |
-
text_input = gr.Textbox(lines=10, placeholder="Write your blog here...", label="Text Editor")
|
| 46 |
button1 = gr.Button("Insert Image Table", elem_id="button1")
|
| 47 |
button2 = gr.Button("Insert Tip Format", elem_id="button2")
|
| 48 |
button3 = gr.Button("Insert Reference", elem_id="button3")
|
|
|
|
| 23 |
Happy blogging!
|
| 24 |
"""
|
| 25 |
|
| 26 |
+
default_md = """||
|
| 27 |
+
|:--:|
|
| 28 |
+
|Figure x: Caption|
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
<div style="background-color: #e6f9e6; padding: 16px 32px; outline: 2px solid; border-radius: 10px;">
|
| 32 |
+
This is text with a tip format! Use sparingly
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
[[1]](#1)
|
| 37 |
+
|
| 38 |
+
<a id="1">[1]</a> : Derek Thomas, [Hugging Face Blog Assistant](https://huggingface.co/spaces/derek-thomas/hugging-face-blog-assistant/edit/main/app.py), 2024
|
| 39 |
+
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
# Functions to append snippets at the end of the text
|
| 43 |
def append_snippet1(text):
|
| 44 |
return text + snippet1
|
|
|
|
| 54 |
return text
|
| 55 |
|
| 56 |
with gr.Blocks() as demo:
|
| 57 |
+
gr.Markdown(intro_md)
|
| 58 |
|
| 59 |
with gr.Row():
|
| 60 |
with gr.Column():
|
| 61 |
+
text_input = gr.Textbox(value=default_md, lines=10, placeholder="Write your blog here...", label="Text Editor")
|
| 62 |
button1 = gr.Button("Insert Image Table", elem_id="button1")
|
| 63 |
button2 = gr.Button("Insert Tip Format", elem_id="button2")
|
| 64 |
button3 = gr.Button("Insert Reference", elem_id="button3")
|