produces the correct html code and summary. Next objective is to be able to push it to wordpress directly from this gradio UI.

This commit is contained in:
shahab00x 2024-02-19 01:22:32 +03:30
parent de5f91852a
commit a7452b5d4b

View File

@ -28,8 +28,12 @@ def replace_img_tag(html_text, img_dict):
return new_html_text
def upload_to_wordpress(html_content):
print("upload_to_wordpress() is called\n")
print(html_content)
pass
def write_article(url, ai_prompt):
def write_article(url):
# Your logic to fetch HTML content from the URL
# Replace this with your actual implementation
@ -48,14 +52,19 @@ def write_article(url, ai_prompt):
return html_content
# Define the Gradio interface
iface = gr.Interface(
fn=write_article,
inputs=["text", gr.components.Textbox(lines=10, placeholder="Enter AI prompt here...", label="AI Prompt:")], # Text input for the URL
outputs="html", # Display HTML content
title="URL to HTML Converter",
description="Enter a URL to get its HTML content."
)
with gr.Blocks() as demo:
gr.Markdown("Start typing below and then click **Run** to see the output.")
# Launch the Gradio app
iface.launch(server_port=7373, share=True)
with gr.Row():
with gr.Column():
inp = gr.Textbox(placeholder="Amazon link:")
btn_write_article = gr.Button("Write Article")
btn_upload_to_wordpress = gr.Button("Upload To Wordpress")
with gr.Column():
html_output = gr.HTML()
btn_write_article.click(write_article, inputs=[inp], outputs=html_output)
btn_upload_to_wordpress.click(upload_to_wordpress, inputs=[html_output])
demo.launch(server_port=7373, share=True)