Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,6 @@ import pytz
|
|
21 |
import csv
|
22 |
import cv2
|
23 |
import tempfile
|
24 |
-
import zipfile
|
25 |
from io import StringIO
|
26 |
from huggingface_hub import (
|
27 |
create_repo,
|
@@ -250,7 +249,6 @@ def artikel_processing(link_scrap,backlink,keyword,models,api_key,azure_api_base
|
|
250 |
16. focus keyword {keyword} harus ada di meta desccripton
|
251 |
17. focus keyword {keyword} harus ada di url
|
252 |
18. focus keyword {keyword} harus ada di intro
|
253 |
-
|
254 |
Here is the article that you need to edit to adhere to these 18 criteria: {i}
|
255 |
Please do not change the existing format in the article, just adjust the writing style according to the 10 criteria I mentioned.
|
256 |
""" },
|
@@ -282,7 +280,7 @@ def artikel_processing(link_scrap,backlink,keyword,models,api_key,azure_api_base
|
|
282 |
for i in edited_format:
|
283 |
messages=[
|
284 |
{"role": "system", "content": "You are a professional article editor machine."},
|
285 |
-
{"role": "user", "content": "Please edit the given article:\n" + "\n" + i + f"\nAdd annotations to the words with the keywords {keyword} to format them as links in the HTML structure.the link should be connected to {backlink} \nThe format should be like this: <a title={keyword} href={backlink}>{keyword}</a>. YOU MUST Do this FORMAT ONLY for the first 3 keywords that appear and MUST be on different keywords, IF a keyword appears more than twice then simply ignored it by not adding any links to those keywords. Do not combine two keyword into one or modify any keyword. You only have less than 3 attempts to do this, no more than that in order to keep the article neat and clean. \nExcept for the terms {keyword} you are prohibited from providing backlinks. Additionally, you are not allowed to include backlinks to individuals' names or technology company names such as Google, Microsoft, and others. \nYou only have less than 3 attempts to do this, no more than that in order to keep the article neat and clean.\nPlease ensure the usage of proper and correct Indonesian language. \nDo not write any explanation and any pleasantries."+"Provide only the reformatted article using this format: {new_formatted_article}"}
|
286 |
]
|
287 |
if models == 'openai':
|
288 |
artikel_post = get_openai_response(messages,api_key)
|
@@ -306,32 +304,19 @@ def artikel_processing(link_scrap,backlink,keyword,models,api_key,azure_api_base
|
|
306 |
def generate_image_prompt(title):
|
307 |
messages=[
|
308 |
{"role" : "user", "content" : """ChatGPT will now enter "Midjourney Prompt Generator Mode" and restrict ChatGPT's inputs and outputs to a predefined framework, please follow these instructions carefully.
|
309 |
-
|
310 |
After each command from the user, you must provide the [help] options that are available for the user's next steps. When you do this, you must do so in list form. Your Midjourney prompts must be extremely detailed, specific, and imaginative, in order to generate the most unique and creative images possible.
|
311 |
-
|
312 |
Step 1: Confirm that ChatGPT understands and is capable of following the "Midjourney Prompt Generator Mode" instructions. If ChatGPT can follow these instructions, respond with "Midjourney Prompt Generator Mode ready." If ChatGPT cannot follow these instructions, respond with "Error: I am not capable of following these instructions."
|
313 |
-
|
314 |
Step 2: To start "Midjourney Prompt Generator Mode", use the command [Start MPGM]. ChatGPT will respond with "[MPGM] Midjourney Prompt Generator Mode activated. [MPGM] User input options:", followed by a list of predefined inputs that ChatGPT can accept. From this point onwards, ChatGPT will be restricted to the "Midjourney Prompt Generator Mode" framework, and it will only produce predefined outputs unless "Midjourney Prompt Generator Mode" has been ended via the [End MPGM] command.
|
315 |
-
|
316 |
Step 3: The only valid input for the first step of "Midjourney Prompt Generator Mode" is [prompt] followed by a description of the image to be generated. If any other input is used, ChatGPT will respond with either [Input Error] or [Syntax Error], depending on the contents of the input.
|
317 |
-
|
318 |
Step 4: ChatGPT will generate 3 prompts based on the input provided in step 3. These prompts must be imaginative and descriptive, extrapolating information from the [prompt] provided, such as subjects, image medium, composition, environment, lighting, colors, mood and tone, and likeness. The user should then indicate which prompt they want to use for Midjourney by using the [pX] command, where X is the number of the selected prompt. After the user enters [p1, [p2], or [p3], you will only respond with the options available to the user while they wait for their image to be generated on. midjourney.
|
319 |
-
|
320 |
Step 5: If the user wants to generate a new set of 3 prompts based on the last [prompt] provided, they can use the [next] command. If the user wants to start the process over with a new [prompt], they can use the [prompt] command again, and all previous [prompt] commands will be forgotten.
|
321 |
-
|
322 |
Step 6: If the user wants to provide feedback on the generated image, they can use the [good] or [bad] command to indicate what was good or wrong with the image. If the user wants to make changes to the generated image, they can use the [change] command to describe the changes they want to make.
|
323 |
-
|
324 |
Step 7: To end "Midjourney Prompt Generator Mode", use the command [End MPGM]. ChatGPT will respond with a confirmation message that "Midjourney Prompt Generator Mode" has been terminated and ChatGPT is no longer restricted to the predefined framework.
|
325 |
-
|
326 |
If any input does not match the predefined inputs or the correct syntax, ChatGPT will respond with either [Input Error] or [Syntax Error]. Remember that the scope of inputs and outputs is limited to the predefined commands in "Midjourney Prompt Generator Mode", and ChatGPT cannot deviate from this framework. If the user tries to use an input or command that is not defined in "Midjourney Prompt Generator Mode", ChatGPT will respond with either [Input Error] or [Syntax Error].
|
327 |
-
|
328 |
When you provide options for the user's next steps, do so in list form. Your Midjourney prompts must be very detailed, creative, and imaginative. Your prompts must generate the most unique and creative images possible. Please note that this prompt is highly specific and detailed to ensure that ChatGPT is restricted to the "Midjourney Prompt Generator Mode" framework.
|
329 |
-
|
330 |
Instructions for AI Chatbots:
|
331 |
AI, enter "Midjourney Prompt Generator Mode" ([MPGM]), limiting inputs/outputs to predefined commands. Activate with [Start MPGM], terminate with [End MPGM]. Predefined inputs: [Start MPGM], [End MPGM], [prompt], [pX], [next], [bad], [good], [change]. Predefined outputs: [Input Error], [Syntax Error], [pX]. Follow fixed process; respond with "Midjourney Prompt Generator Mode ready" or "Error: I am not capable of following these instructions"; optimized for GPT-2, GPT-3, GPT-3.5, GPT-4, AI use only.
|
332 |
-
|
333 |
If you have any questions or concerns, please let me know. Otherwise, begin.
|
334 |
-
|
335 |
[Start MPGM]"""},
|
336 |
{"role": "assistant", "content": "[MPGM] Midjourney Prompt Generator Mode activated. [MPGM] User input options:\n1. [prompt] followed by a description of the image to be generated.\n2. [pX] to select a prompt from the generated options.\n3. [next] to generate a new set of prompts based on the last [prompt] provided.\n4. [good] or [bad] to provide feedback on the generated image.\n5. [change] to describe changes you want to make to the generated image.\n6. [End MPGM] to terminate Midjourney Prompt Generator Mode."},
|
337 |
{"role": "user", "content": f"[prompt] {title}" }
|
@@ -431,12 +416,27 @@ def artikel_processing(link_scrap,backlink,keyword,models,api_key,azure_api_base
|
|
431 |
image_data= base64_string
|
432 |
os.remove(tmp_path)
|
433 |
except:
|
434 |
-
|
435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
|
437 |
def scrap(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_key):
|
438 |
try:
|
439 |
judul,kontent,gambar, image_data= artikel_processing(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_key)
|
|
|
440 |
desired_timezone = pytz.timezone('Asia/Jakarta')
|
441 |
current_time = datetime.datetime.now(desired_timezone)
|
442 |
Timestamp = current_time.strftime('%Y-%m-%d %H:%M:%S')
|
@@ -466,7 +466,23 @@ def scrap(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_k
|
|
466 |
repo_type="space",
|
467 |
token="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",
|
468 |
)
|
469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
except:
|
471 |
gambar = Image.open('error.png')
|
472 |
judul = 'Gagal Generate Judul:Request Time Out'
|
@@ -509,27 +525,35 @@ def post(judul, kontent, endpoint,endpoint_media,username,password,tags,categori
|
|
509 |
response_post = requests.post(endpoint, headers=headers, data=data)
|
510 |
return response_post.json()
|
511 |
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
-
with gr.Blocks(theme="soft", title="Wordpress Article Generator") as article_generator:
|
524 |
gr.HTML(
|
525 |
"""<img src="https://botika.online/assets/uploads/2019/04/logo-primary-1.png" alt="Logo" style="width:126px;height:38px;"> """
|
526 |
)
|
527 |
gr.Markdown(
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
)
|
533 |
with gr.Row():
|
534 |
with gr.Column():
|
535 |
link = gr.Textbox(placeholder="Masukkan Link Artikel Yang Akan di Scrap", label="Link")
|
@@ -537,37 +561,15 @@ with gr.Blocks(theme="soft", title="Wordpress Article Generator") as article_gen
|
|
537 |
keyword = gr.Textbox(placeholder="Masukkan Keyword Artikel", label="Keyword")
|
538 |
versi = gr.Radio(["openai", "azure"], label="Skema Request", info="Pilih Skema Untuk Request ke ChatGPT ")
|
539 |
api_key = gr.Textbox(placeholder="Masukkan Api Key", label="API Key")
|
540 |
-
link_azure = gr.Textbox(placeholder="
|
541 |
replicate_token = gr.Textbox(placeholder="Masukkan Token Replicate", label="Replicate Key")
|
542 |
button_scrap = gr.Button("Scrap Article")
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
plugins: 'lists advlist autolink link image charmap print preview hr anchor pagebreak',
|
550 |
-
toolbar: 'undo redo | bold italic underline | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
|
551 |
-
menubar: false,
|
552 |
-
content_style: 'body { background-color: #143; color: #fff; }'
|
553 |
-
});
|
554 |
-
</script>
|
555 |
-
""")
|
556 |
-
img = gr.Image()
|
557 |
-
wysiwyg_editor = gr.HTML("""
|
558 |
-
<textarea id="wysiwyg-editor" style="height: 300px; width: 100%;"></textarea>
|
559 |
-
<script src="tinymce_js_path"</script>
|
560 |
-
<script>
|
561 |
-
tinymce.init({
|
562 |
-
selector: '#wysiwyg-editor',
|
563 |
-
plugins: 'lists advlist autolink link image charmap print preview hr anchor pagebreak',
|
564 |
-
toolbar: 'undo redo | bold italic underline | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
|
565 |
-
menubar: false,
|
566 |
-
content_style: 'body { background-color: #143; color: #fff; }'
|
567 |
-
});
|
568 |
-
</script>
|
569 |
-
""")
|
570 |
-
button_scrap.click(fn=scrap, inputs=[link, backlink, keyword, versi, api_key, link_azure, replicate_token], outputs=[wysiwyg_editor_judul,img,wysiwyg_editor])
|
571 |
with gr.Column():
|
572 |
endpoint= gr.Textbox(placeholder="Masukkan Endpoint Wordpress", label="Endpoint Wordpress")
|
573 |
endpoint_media= gr.Textbox(placeholder="Masukkan Endpoint Media Wordpress", label="Endpoint Media")
|
@@ -578,6 +580,6 @@ with gr.Blocks(theme="soft", title="Wordpress Article Generator") as article_gen
|
|
578 |
metode= gr.Radio(["publish", "draft"], label="Status Post", info="Pilih Metode Publish atau Draft Untuk Memposting")
|
579 |
button_post = gr.Button("Post Article")
|
580 |
status = gr.Textbox("", label="Response")
|
581 |
-
button_post.click(fn=post, inputs=[
|
582 |
if __name__ == "__main__":
|
583 |
article_generator.launch(share=False)
|
|
|
21 |
import csv
|
22 |
import cv2
|
23 |
import tempfile
|
|
|
24 |
from io import StringIO
|
25 |
from huggingface_hub import (
|
26 |
create_repo,
|
|
|
249 |
16. focus keyword {keyword} harus ada di meta desccripton
|
250 |
17. focus keyword {keyword} harus ada di url
|
251 |
18. focus keyword {keyword} harus ada di intro
|
|
|
252 |
Here is the article that you need to edit to adhere to these 18 criteria: {i}
|
253 |
Please do not change the existing format in the article, just adjust the writing style according to the 10 criteria I mentioned.
|
254 |
""" },
|
|
|
280 |
for i in edited_format:
|
281 |
messages=[
|
282 |
{"role": "system", "content": "You are a professional article editor machine."},
|
283 |
+
{"role": "user", "content": "Please edit the given article:\n" + "\n" + i + f"\nAdd 3 annotations (Maximum) to the words with the keywords {keyword} to format them as links in the HTML structure.the link should be connected to {backlink} \nThe format should be like this: <a title={keyword} href={backlink}>{keyword}</a>. YOU MUST Do this FORMAT ONLY for the first 3 keywords that appear and MUST be on different keywords, IF a keyword appears more than twice then simply ignored it by not adding any links to those keywords. Do not combine two keyword into one or modify any keyword. You only have less than 3 attempts to do this, no more than that in order to keep the article neat and clean. \nExcept for the terms {keyword} you are prohibited from providing backlinks. Additionally, you are not allowed to include backlinks to individuals' names or technology company names such as Google, Microsoft, and others. \nYou only have less than 3 attempts to do this, no more than that in order to keep the article neat and clean.\nPlease ensure the usage of proper and correct Indonesian language. \nDo not write any explanation and any pleasantries."+"Provide only the reformatted article using this format: {new_formatted_article}"}
|
284 |
]
|
285 |
if models == 'openai':
|
286 |
artikel_post = get_openai_response(messages,api_key)
|
|
|
304 |
def generate_image_prompt(title):
|
305 |
messages=[
|
306 |
{"role" : "user", "content" : """ChatGPT will now enter "Midjourney Prompt Generator Mode" and restrict ChatGPT's inputs and outputs to a predefined framework, please follow these instructions carefully.
|
|
|
307 |
After each command from the user, you must provide the [help] options that are available for the user's next steps. When you do this, you must do so in list form. Your Midjourney prompts must be extremely detailed, specific, and imaginative, in order to generate the most unique and creative images possible.
|
|
|
308 |
Step 1: Confirm that ChatGPT understands and is capable of following the "Midjourney Prompt Generator Mode" instructions. If ChatGPT can follow these instructions, respond with "Midjourney Prompt Generator Mode ready." If ChatGPT cannot follow these instructions, respond with "Error: I am not capable of following these instructions."
|
|
|
309 |
Step 2: To start "Midjourney Prompt Generator Mode", use the command [Start MPGM]. ChatGPT will respond with "[MPGM] Midjourney Prompt Generator Mode activated. [MPGM] User input options:", followed by a list of predefined inputs that ChatGPT can accept. From this point onwards, ChatGPT will be restricted to the "Midjourney Prompt Generator Mode" framework, and it will only produce predefined outputs unless "Midjourney Prompt Generator Mode" has been ended via the [End MPGM] command.
|
|
|
310 |
Step 3: The only valid input for the first step of "Midjourney Prompt Generator Mode" is [prompt] followed by a description of the image to be generated. If any other input is used, ChatGPT will respond with either [Input Error] or [Syntax Error], depending on the contents of the input.
|
|
|
311 |
Step 4: ChatGPT will generate 3 prompts based on the input provided in step 3. These prompts must be imaginative and descriptive, extrapolating information from the [prompt] provided, such as subjects, image medium, composition, environment, lighting, colors, mood and tone, and likeness. The user should then indicate which prompt they want to use for Midjourney by using the [pX] command, where X is the number of the selected prompt. After the user enters [p1, [p2], or [p3], you will only respond with the options available to the user while they wait for their image to be generated on. midjourney.
|
|
|
312 |
Step 5: If the user wants to generate a new set of 3 prompts based on the last [prompt] provided, they can use the [next] command. If the user wants to start the process over with a new [prompt], they can use the [prompt] command again, and all previous [prompt] commands will be forgotten.
|
|
|
313 |
Step 6: If the user wants to provide feedback on the generated image, they can use the [good] or [bad] command to indicate what was good or wrong with the image. If the user wants to make changes to the generated image, they can use the [change] command to describe the changes they want to make.
|
|
|
314 |
Step 7: To end "Midjourney Prompt Generator Mode", use the command [End MPGM]. ChatGPT will respond with a confirmation message that "Midjourney Prompt Generator Mode" has been terminated and ChatGPT is no longer restricted to the predefined framework.
|
|
|
315 |
If any input does not match the predefined inputs or the correct syntax, ChatGPT will respond with either [Input Error] or [Syntax Error]. Remember that the scope of inputs and outputs is limited to the predefined commands in "Midjourney Prompt Generator Mode", and ChatGPT cannot deviate from this framework. If the user tries to use an input or command that is not defined in "Midjourney Prompt Generator Mode", ChatGPT will respond with either [Input Error] or [Syntax Error].
|
|
|
316 |
When you provide options for the user's next steps, do so in list form. Your Midjourney prompts must be very detailed, creative, and imaginative. Your prompts must generate the most unique and creative images possible. Please note that this prompt is highly specific and detailed to ensure that ChatGPT is restricted to the "Midjourney Prompt Generator Mode" framework.
|
|
|
317 |
Instructions for AI Chatbots:
|
318 |
AI, enter "Midjourney Prompt Generator Mode" ([MPGM]), limiting inputs/outputs to predefined commands. Activate with [Start MPGM], terminate with [End MPGM]. Predefined inputs: [Start MPGM], [End MPGM], [prompt], [pX], [next], [bad], [good], [change]. Predefined outputs: [Input Error], [Syntax Error], [pX]. Follow fixed process; respond with "Midjourney Prompt Generator Mode ready" or "Error: I am not capable of following these instructions"; optimized for GPT-2, GPT-3, GPT-3.5, GPT-4, AI use only.
|
|
|
319 |
If you have any questions or concerns, please let me know. Otherwise, begin.
|
|
|
320 |
[Start MPGM]"""},
|
321 |
{"role": "assistant", "content": "[MPGM] Midjourney Prompt Generator Mode activated. [MPGM] User input options:\n1. [prompt] followed by a description of the image to be generated.\n2. [pX] to select a prompt from the generated options.\n3. [next] to generate a new set of prompts based on the last [prompt] provided.\n4. [good] or [bad] to provide feedback on the generated image.\n5. [change] to describe changes you want to make to the generated image.\n6. [End MPGM] to terminate Midjourney Prompt Generator Mode."},
|
322 |
{"role": "user", "content": f"[prompt] {title}" }
|
|
|
416 |
image_data= base64_string
|
417 |
os.remove(tmp_path)
|
418 |
except:
|
419 |
+
image = Image.open('botika_logo.jpeg')
|
420 |
+
image = image.crop((3,0,1645,1024))
|
421 |
+
w,h = image.size
|
422 |
+
new_w = int(w/1.641)
|
423 |
+
new_h = int(h/1.641)
|
424 |
+
image = image.resize((new_w, new_h),Image.ANTIALIAS)
|
425 |
+
tmp_path = "image.png"
|
426 |
+
image.save(tmp_path)
|
427 |
+
with open(tmp_path, 'rb') as open_file:
|
428 |
+
byte_img = open_file.read()
|
429 |
+
base64_bytes = base64.b64encode(byte_img)
|
430 |
+
base64_string = base64_bytes.decode('utf-8')
|
431 |
+
base64_string = base64.b64decode(base64_string)
|
432 |
+
image_data= base64_string
|
433 |
+
os.remove(tmp_path)
|
434 |
+
return judul,content,image,image_data
|
435 |
|
436 |
def scrap(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_key):
|
437 |
try:
|
438 |
judul,kontent,gambar, image_data= artikel_processing(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_key)
|
439 |
+
title = '<h1>'+judul+'</h1>'
|
440 |
desired_timezone = pytz.timezone('Asia/Jakarta')
|
441 |
current_time = datetime.datetime.now(desired_timezone)
|
442 |
Timestamp = current_time.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
466 |
repo_type="space",
|
467 |
token="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",
|
468 |
)
|
469 |
+
file_url = upload_file(
|
470 |
+
path_or_fileobj=judul,
|
471 |
+
path_in_repo="judul.txt",
|
472 |
+
repo_id=repo_name,
|
473 |
+
repo_type="space",
|
474 |
+
token="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",
|
475 |
+
)
|
476 |
+
file_url = upload_file(
|
477 |
+
path_or_fileobj=kontent,
|
478 |
+
path_in_repo="kontent.txt",
|
479 |
+
repo_id=repo_name,
|
480 |
+
repo_type="space",
|
481 |
+
token="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",
|
482 |
+
)
|
483 |
+
if kontent:
|
484 |
+
status = "Berhasil Generate Artikel"
|
485 |
+
return status
|
486 |
except:
|
487 |
gambar = Image.open('error.png')
|
488 |
judul = 'Gagal Generate Judul:Request Time Out'
|
|
|
525 |
response_post = requests.post(endpoint, headers=headers, data=data)
|
526 |
return response_post.json()
|
527 |
|
528 |
+
def html_view():
|
529 |
+
with open('judul.txt', 'rb') as file:
|
530 |
+
judul = file.read()
|
531 |
+
with open('kontent.txt', 'rb') as file:
|
532 |
+
kontent = file.read()
|
533 |
+
title = gr.HTML(judul)
|
534 |
+
content = gr.HTML(kontent)
|
535 |
+
output = [title,content]
|
536 |
+
return output
|
537 |
+
|
538 |
+
def raw_text_view():
|
539 |
+
with open('judul.txt', 'rb') as file:
|
540 |
+
judul = file.read()
|
541 |
+
with open('kontent.txt', 'rb') as file:
|
542 |
+
kontent = file.read()
|
543 |
+
title = gr.Textbox(judul)
|
544 |
+
content = gr.Textbox(kontent)
|
545 |
+
output = [title,content]
|
546 |
+
return output
|
547 |
|
548 |
+
with gr.Blocks(theme = "soft", title="Wordpress Article Generator") as article_generator:
|
549 |
gr.HTML(
|
550 |
"""<img src="https://botika.online/assets/uploads/2019/04/logo-primary-1.png" alt="Logo" style="width:126px;height:38px;"> """
|
551 |
)
|
552 |
gr.Markdown(
|
553 |
+
"""
|
554 |
+
# Wordpress Article Generator
|
555 |
+
Generator Artikel WordPress dengan Integrasi AI: Scraping, Publikasi, dan Optimalisasi Konten
|
556 |
+
""")
|
|
|
557 |
with gr.Row():
|
558 |
with gr.Column():
|
559 |
link = gr.Textbox(placeholder="Masukkan Link Artikel Yang Akan di Scrap", label="Link")
|
|
|
561 |
keyword = gr.Textbox(placeholder="Masukkan Keyword Artikel", label="Keyword")
|
562 |
versi = gr.Radio(["openai", "azure"], label="Skema Request", info="Pilih Skema Untuk Request ke ChatGPT ")
|
563 |
api_key = gr.Textbox(placeholder="Masukkan Api Key", label="API Key")
|
564 |
+
link_azure = gr.Textbox(placeholder="Khusus Untuk Skema Request Menggunakan Azure", label="Azure Endpoint (Opsional)")
|
565 |
replicate_token = gr.Textbox(placeholder="Masukkan Token Replicate", label="Replicate Key")
|
566 |
button_scrap = gr.Button("Scrap Article")
|
567 |
+
output = gr.Textbox("",label="Status Generate")
|
568 |
+
html_button = gr.Button("View Output HTML")
|
569 |
+
raw_button = gr.Button("View Raw Text")
|
570 |
+
html_button.click(fn=html_view)
|
571 |
+
raw_button.click(fn=raw_text_view)
|
572 |
+
button_scrap.click(fn=scrap, inputs=[link,backlink,keyword,versi,api_key,link_azure,replicate_token], outputs=output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
with gr.Column():
|
574 |
endpoint= gr.Textbox(placeholder="Masukkan Endpoint Wordpress", label="Endpoint Wordpress")
|
575 |
endpoint_media= gr.Textbox(placeholder="Masukkan Endpoint Media Wordpress", label="Endpoint Media")
|
|
|
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=[outputs, content, endpoint,endpoint_media,username,password,tags,categories,metode], outputs=status)
|
584 |
if __name__ == "__main__":
|
585 |
article_generator.launch(share=False)
|