Spaces:
Sleeping
Sleeping
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) | |