Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -489,14 +489,18 @@ def scrap(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_k
|
|
489 |
kontent = 'Gagal Generate Artikel:Request Time Out'
|
490 |
return judul,gambar,kontent
|
491 |
|
492 |
-
def post(
|
493 |
credentials = base64.b64encode(f"{username}:{password}".encode("utf-8")).decode("utf-8")
|
494 |
headers = {"Authorization": f"Basic {credentials}"}
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
with open(file_path, 'rb') as file:
|
499 |
file_content = file.read()
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
|
501 |
data = {
|
502 |
"alt_text": judul,
|
@@ -580,6 +584,6 @@ with gr.Blocks(theme = "soft", title="Wordpress Article Generator") as article_g
|
|
580 |
metode= gr.Radio(["publish", "draft"], label="Status Post", info="Pilih Metode Publish atau Draft Untuk Memposting")
|
581 |
button_post = gr.Button("Post Article")
|
582 |
status = gr.Textbox("", label="Response")
|
583 |
-
button_post.click(fn=post, inputs=[
|
584 |
if __name__ == "__main__":
|
585 |
article_generator.launch(share=False)
|
|
|
489 |
kontent = 'Gagal Generate Artikel:Request Time Out'
|
490 |
return judul,gambar,kontent
|
491 |
|
492 |
+
def post(endpoint,endpoint_media,username,password,tags,categories,metode):
|
493 |
credentials = base64.b64encode(f"{username}:{password}".encode("utf-8")).decode("utf-8")
|
494 |
headers = {"Authorization": f"Basic {credentials}"}
|
495 |
|
496 |
+
with open('image_data.txt', 'rb') as file:
|
|
|
|
|
497 |
file_content = file.read()
|
498 |
+
|
499 |
+
with open('judul.txt', 'rb') as file:
|
500 |
+
judul = file.read()
|
501 |
+
|
502 |
+
with open('kontent.txt', 'rb') as file:
|
503 |
+
kontent = file.read()
|
504 |
|
505 |
data = {
|
506 |
"alt_text": judul,
|
|
|
584 |
metode= gr.Radio(["publish", "draft"], label="Status Post", info="Pilih Metode Publish atau Draft Untuk Memposting")
|
585 |
button_post = gr.Button("Post Article")
|
586 |
status = gr.Textbox("", label="Response")
|
587 |
+
button_post.click(fn=post, inputs=[endpoint,endpoint_media,username,password,tags,categories,metode], outputs=status)
|
588 |
if __name__ == "__main__":
|
589 |
article_generator.launch(share=False)
|