derek-thomas HF staff commited on
Commit
78ae771
1 Parent(s): 29f0805

Using better examples and adding intro

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -1,15 +1,27 @@
1
  import gradio as gr
2
 
3
  # Define the pre-stored text snippets
4
- snippet1 = """\n\n|![Link Text](www.example.com)|
5
  |:--:|
6
  |Figure x: Caption|
7
  """
8
  snippet2 = """\n\n<div style="background-color: #e6f9e6; padding: 16px 32px; outline: 2px solid; border-radius: 10px;">
9
- This is text with a tip format!
10
  </div>
11
  """
12
- snippet3 = """\n\n[[1]](#1)\n\n<a id="1">[1]</a> : First Last, [Example](www.example.com), 2021"""
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # Functions to append snippets at the end of the text
15
  def append_snippet1(text):
@@ -26,7 +38,7 @@ def preview_text(text):
26
  return text
27
 
28
  with gr.Blocks() as demo:
29
- gr.Markdown("# Blog Writing Helper")
30
 
31
  with gr.Row():
32
  with gr.Column():
 
1
  import gradio as gr
2
 
3
  # Define the pre-stored text snippets
4
+ snippet1 = """\n\n|![Hugging Face Logo](https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo-with-title.svg)|
5
  |:--:|
6
  |Figure x: Caption|
7
  """
8
  snippet2 = """\n\n<div style="background-color: #e6f9e6; padding: 16px 32px; outline: 2px solid; border-radius: 10px;">
9
+ This is text with a tip format! Use sparingly
10
  </div>
11
  """
12
+ snippet3 = """\n\n[[1]](#1)\n\n<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"""
13
+
14
+ intro_md = """# Blog Writing Assistant
15
+
16
+ Easily create and edit your blog posts with our intuitive text editor. Use the buttons to quickly insert predefined snippets for image tables, tip formats, and references, and see your changes in real-time with the live preview on the right.
17
+
18
+ **How to Use:**
19
+ 1. Write your blog content in the text editor.
20
+ 2. Click the buttons to add predefined snippets.
21
+ 3. View the live preview to see your formatted blog post.
22
+
23
+ Happy blogging!
24
+ """
25
 
26
  # Functions to append snippets at the end of the text
27
  def append_snippet1(text):
 
38
  return text
39
 
40
  with gr.Blocks() as demo:
41
+ gr.Markdown()
42
 
43
  with gr.Row():
44
  with gr.Column():