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:
parent
de5f91852a
commit
a7452b5d4b
31
webui.py
31
webui.py
@ -28,8 +28,12 @@ def replace_img_tag(html_text, img_dict):
|
|||||||
|
|
||||||
return new_html_text
|
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
|
# Your logic to fetch HTML content from the URL
|
||||||
# Replace this with your actual implementation
|
# Replace this with your actual implementation
|
||||||
|
|
||||||
@ -48,14 +52,19 @@ def write_article(url, ai_prompt):
|
|||||||
return html_content
|
return html_content
|
||||||
|
|
||||||
|
|
||||||
# Define the Gradio interface
|
with gr.Blocks() as demo:
|
||||||
iface = gr.Interface(
|
gr.Markdown("Start typing below and then click **Run** to see the output.")
|
||||||
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."
|
|
||||||
)
|
|
||||||
|
|
||||||
# Launch the Gradio app
|
with gr.Row():
|
||||||
iface.launch(server_port=7373, share=True)
|
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)
|
Loading…
x
Reference in New Issue
Block a user