File size: 2,531 Bytes
6c40cb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a0b282
6c40cb7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import gradio as gr
from post_blog import main

def post_blog(title, category, summary, mindmap, citation, access_key):
    status = main(title, category, summary, mindmap, citation, access_key)
    return status

def clear_everything(title, category, summary, mindmap, citation, status, access_key):
    return None, None, None, None, None, None, None

theme = gr.themes.Soft(
    primary_hue="purple",
    secondary_hue="cyan",
    neutral_hue="slate",
    font=[
        gr.themes.GoogleFont("Syne"), 
        gr.themes.GoogleFont("Poppins"), 
        gr.themes.GoogleFont("Poppins"), 
        gr.themes.GoogleFont("Poppins")
    ],
)

with gr.Blocks(theme=theme, title="ReXplore Blog Poster", fill_height=True) as app:
    gr.HTML(
        value ="""
        <h1 style="text-align: center;">ReXplore Blog Poster <p style="text-align: center;">Designed and Developed by <a href="https://raannakasturi.eu.org" target="_blank" rel="nofollow noreferrer external">Nayan Kasturi</a></p> </h1>
        <p style="text-align: center;">This app posts Blogs to Blogger.</p>
        """)
    with gr.Column():
        with gr.Row():
            title = gr.Textbox(label="Title", placeholder="Enter Blog Title")
            category = gr.Textbox(label="Category", placeholder="Enter Blog Category")
            access_key = gr.Textbox(label="Access Key", placeholder="Enter the Access Key", type="password")
        with gr.Row():
            summary = gr.Textbox(label="Summary", placeholder="Enter the summary", lines=7)
            mindmap = gr.Textbox(label="Mindmap", placeholder="Enter the mindmap", lines=7)
            citation = gr.Textbox(label="Citation", placeholder="Enter the citation", lines=7)
        with gr.Row():
            clear_btn = gr.Button(value="Clear", variant="stop")
            summarize_btn = gr.Button(value="Post Blog", variant="primary")
        status = gr.Textbox(label="Status", placeholder="Blog Post Status", interactive=False)
    summarize_btn.click(
        post_blog,
        inputs=[category, title, summary, mindmap, citation, access_key],
        outputs=[status],
        concurrency_limit=25,
        scroll_to_output=True,
        show_api=True,
        api_name="rexplore_blog_poster",
        show_progress="full",
    )
    clear_btn.click(clear_everything, inputs=[category, title, summary, mindmap, citation, access_key, status], outputs=[category, title, summary, mindmap, citation, access_key, status], show_api=False)

app.queue(default_concurrency_limit=25).launch(show_api=True)