Adding snippets
Browse files
app.py
CHANGED
|
@@ -1,8 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
# Define the pre-stored text snippets
|
| 4 |
-
snippet1 = "
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Function to insert snippet at a given position
|
| 8 |
def insert_snippet(text, snippet, position):
|
|
@@ -37,7 +43,7 @@ with gr.Blocks() as demo:
|
|
| 37 |
with gr.Row():
|
| 38 |
with gr.Column():
|
| 39 |
text_input = gr.Textbox(lines=10, placeholder="Write your blog here...", label="Text Editor")
|
| 40 |
-
button1 = gr.Button("Insert
|
| 41 |
button2 = gr.Button("Insert Snippet 2", elem_id="button2")
|
| 42 |
with gr.Column():
|
| 43 |
gr.Markdown("**Live Preview**")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
# Define the pre-stored text snippets
|
| 4 |
+
snippet1 = """||
|
| 5 |
+
|:--:|
|
| 6 |
+
|Figure x: Caption|
|
| 7 |
+
"""
|
| 8 |
+
snippet2 = """<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 |
|
| 13 |
# Function to insert snippet at a given position
|
| 14 |
def insert_snippet(text, snippet, position):
|
|
|
|
| 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 Snippet 2", elem_id="button2")
|
| 48 |
with gr.Column():
|
| 49 |
gr.Markdown("**Live Preview**")
|