"""
main module blog generator.
"""
import gradio as gr
from module.generator import (generate_blog)
###################### Front-end ########################
with gr.Blocks(theme = gr.themes.Monochrome()) as demo:
gr.Markdown("""
Writer.ai
Blog and essay writer ai tool
""")
with gr.Column():
output_block = gr.Markdown(line_breaks = True)
with gr.Row():
topic = gr.Text(label = "Topic",
placeholder = "essay or blog topic")
content_type = gr.Text(label = "Type",
placeholder = "essay, blog post")
tone = gr.Text(label = "Tone",
placeholder = "soft, professional")
link = gr.Text(label = "link",
placeholder = "links with comma seperated")
length = gr.Text(label = "Length",
placeholder = "length of generated contents")
with gr.Row():
stop_button = gr.Button("Stop")
resume_button = gr.Button("Resume")
start_button = gr.Button("Start")
start_button.click(fn = generate_blog, inputs = [topic,
content_type, link,
tone, length],
outputs = output_block)
demo.queue(max_size = 1)
demo.launch(debug = True)