From a7452b5d4b0cd80281a8a3e56ff9c15c54aed38d Mon Sep 17 00:00:00 2001 From: shahab00x Date: Mon, 19 Feb 2024 01:22:32 +0330 Subject: [PATCH] produces the correct html code and summary. Next objective is to be able to push it to wordpress directly from this gradio UI. --- webui.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/webui.py b/webui.py index fff442a..86e5296 100644 --- a/webui.py +++ b/webui.py @@ -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) \ No newline at end of file