Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,80 +65,59 @@ def clean_scrap(artikel,link, openai_key):
|
|
65 |
article = []
|
66 |
if len(artikel) > 1:
|
67 |
for art in artikel:
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
if finish_reason == 'length' or finish_reason == 'stop':
|
81 |
-
result = response['choices'][0]['message']['content']
|
82 |
-
new_artikel.append(result)
|
83 |
-
except openai.error.OpenAIError as e:
|
84 |
-
print('server sibuk')
|
85 |
else:
|
86 |
-
for art in artikel:
|
87 |
-
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
88 |
-
openai.api_key = openai_key
|
89 |
-
try:
|
90 |
-
response = openai.ChatCompletion.create(
|
91 |
-
model ="gpt-3.5-turbo",
|
92 |
-
messages=[
|
93 |
-
{"role": "system", "content": "You are a very professional article editor."},
|
94 |
-
{"role": "user", "content": "I have a raw article that contains a lot of unnecessary data such as ads, website information, and article publishers, as well as links to other pages, and so on. Please clean up the article I provided so that only the article's content remains." + art + "\nDo not write any explanation and any pleasantries. Please use the following complete format to display the output: {the cleaned article's content}"}
|
95 |
-
],
|
96 |
-
temperature = 0.1
|
97 |
-
)
|
98 |
-
finish_reason = response['choices'][0]['finish_reason']
|
99 |
-
if finish_reason == 'length' or finish_reason == 'stop':
|
100 |
-
result = response['choices'][0]['message']['content']
|
101 |
-
new_artikel.append(result)
|
102 |
-
except openai.error.OpenAIError as e:
|
103 |
-
print('server sibuk')
|
104 |
-
|
105 |
-
new_art = [' '.join(new_artikel)]
|
106 |
-
for art in new_art:
|
107 |
-
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
108 |
-
openai.api_key = openai_key
|
109 |
-
try:
|
110 |
response = openai.ChatCompletion.create(
|
111 |
model ="gpt-3.5-turbo",
|
112 |
messages=[
|
113 |
-
{"role": "system", "content": "You are a very professional article editor
|
114 |
-
{"role": "user", "content": "
|
115 |
-
|
116 |
temperature = 0.1
|
117 |
)
|
118 |
finish_reason = response['choices'][0]['finish_reason']
|
119 |
if finish_reason == 'length' or finish_reason == 'stop':
|
120 |
result = response['choices'][0]['message']['content']
|
121 |
-
|
122 |
-
except openai.error.OpenAIError as e:
|
123 |
-
print('server sibuk')
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
128 |
-
openai.api_key = openai_key
|
129 |
-
try:
|
130 |
response = openai.ChatCompletion.create(
|
131 |
model ="gpt-3.5-turbo",
|
132 |
messages=[
|
133 |
-
{"role": "system", "content": "You are a professional
|
134 |
-
{"role": "user", "content": "
|
135 |
-
|
136 |
-
temperature = 0
|
137 |
)
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
judul = judul.replace("Judul:", '').strip()
|
143 |
judul = judul.replace("Title:", '').strip()
|
144 |
try:
|
@@ -196,132 +175,108 @@ def artikel_processing(link_scrap,backlink,keyword,openai_key,replicate_key):
|
|
196 |
post_article = []
|
197 |
|
198 |
for i in artikel:
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
if finish_reason == 'length' or finish_reason == 'stop':
|
212 |
-
translate = response['choices'][0]['message']['content']
|
213 |
-
translated.append(translate)
|
214 |
-
time.sleep(2)
|
215 |
-
except openai.error.OpenAIError as e:
|
216 |
-
print('server sibuk')
|
217 |
-
|
218 |
-
for i in translated:
|
219 |
-
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
220 |
-
openai.api_key = openai_key
|
221 |
-
try:
|
222 |
-
response = openai.ChatCompletion.create(
|
223 |
-
model ="gpt-3.5-turbo",
|
224 |
-
messages=[
|
225 |
-
{"role": "system", "content": """You are a very professional article editor and perform SEO optimization on an article with utmost professionalism. berikut adalah SOP SEO yang harus kamu terapkan
|
226 |
-
1. meta decription max 160 characters
|
227 |
-
2. title max 60 characters
|
228 |
-
3. sentences max 20 words
|
229 |
-
4. paragraph max 300 words
|
230 |
-
5. sebisa mungkin focus keyword harus ada di title, bagian depan (sifatnya "sebisa mungkin". Kalau tidak bisa, di bagian manapun tidak masalah)
|
231 |
-
6. focus keyword harus ada di content
|
232 |
-
7. focus keyword harus ada di intro
|
233 |
-
8. focus keyword harus ada di meta desc
|
234 |
-
9. focus keyword harus ada di url
|
235 |
-
10. focus keyword harus ada di intro
|
236 |
-
"""},
|
237 |
-
{"role": "user", "content": "Paraphrase the above article to make it a well-written and easily understandable piece for humans, following the conventions of renowned articles.The paraphrased result should be more than 2500 characters and less than 7000 characters. and then perform SEO optimization on the following article:\n" + i + "\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: {reformatted article}"}
|
238 |
-
],
|
239 |
-
temperature = 0
|
240 |
-
)
|
241 |
-
SEO = response['choices'][0]['message']['content']
|
242 |
-
optimized.append(SEO)
|
243 |
time.sleep(2)
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
for i in optimized:
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
article.append(result)
|
286 |
-
time.sleep(2)
|
287 |
-
except openai.error.OpenAIError as e:
|
288 |
-
print('server sibuk')
|
289 |
-
|
290 |
for i in article:
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
edited_format.append(font_formatted)
|
304 |
-
time.sleep(2)
|
305 |
-
except openai.error.OpenAIError as e:
|
306 |
-
print('server sibuk')
|
307 |
-
|
308 |
for i in edited_format:
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
time.sleep(2)
|
322 |
-
except openai.error.OpenAIError as e:
|
323 |
-
print('server sibuk')
|
324 |
-
|
325 |
meta_keywords = '<!-- wp:html –><meta name=”keywords” content=”chabot indonesia, chabot ai, bot master, artificial intelligence,ai, easy manage chatbot, bot ai,integration chatbot, chatbot online,ai chatbot, chatbot gpt, wizard gpt”><!-- /wp:html –->'
|
326 |
post_article.append(meta_keywords)
|
327 |
content = ''.join(post_article)
|
@@ -334,7 +289,6 @@ def artikel_processing(link_scrap,backlink,keyword,openai_key,replicate_key):
|
|
334 |
|
335 |
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
336 |
def generate_image_prompt(title):
|
337 |
-
openai.api_key = openai_key
|
338 |
try:
|
339 |
response = openai.ChatCompletion.create(
|
340 |
model="gpt-3.5-turbo", # engine = "deployment_name".
|
@@ -477,14 +431,15 @@ def artikel_processing(link_scrap,backlink,keyword,openai_key,replicate_key):
|
|
477 |
# selected_columns = result.loc[:, "Judul Artikel":"tags"]
|
478 |
return result,image
|
479 |
|
480 |
-
|
481 |
def scrap(link_scrap,backlink,keyword,openai_key,replicate_key):
|
|
|
482 |
try:
|
483 |
-
data,gambar= artikel_processing(link_scrap,backlink,keyword,
|
484 |
judul = data['Judul Artikel'][0]
|
485 |
kontent = data["Konten Artikel"][0]
|
486 |
return gambar,judul,kontent
|
487 |
-
except:
|
488 |
gambar = Image.open('error.png')
|
489 |
judul = 'Gagal Generate Judul:Request Time Out'
|
490 |
kontent = 'Gagal Generate Artikel:Request Time Out'
|
|
|
65 |
article = []
|
66 |
if len(artikel) > 1:
|
67 |
for art in artikel:
|
68 |
+
response = openai.ChatCompletion.create(
|
69 |
+
model ="gpt-3.5-turbo",
|
70 |
+
messages=[
|
71 |
+
{"role": "system", "content": "You are a very professional article editor."},
|
72 |
+
{"role": "user", "content": "I have a raw article that contains a lot of unnecessary data such as ads, website information, and article publishers, as well as links to other pages, and so on. Please clean up the article I provided so that only the article's content remains. \nThen, you should also summarize the article so that it does not exceed 5000 characters" + art + "\nDo not write any explanation and any pleasantries. Please use the following complete format to display the output: {the cleaned and summarized article's content}"}
|
73 |
+
],
|
74 |
+
temperature = 0.1
|
75 |
+
)
|
76 |
+
finish_reason = response['choices'][0]['finish_reason']
|
77 |
+
if finish_reason == 'length' or finish_reason == 'stop':
|
78 |
+
result = response['choices'][0]['message']['content']
|
79 |
+
new_artikel.append(result)
|
|
|
|
|
|
|
|
|
|
|
80 |
else:
|
81 |
+
for art in artikel:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
response = openai.ChatCompletion.create(
|
83 |
model ="gpt-3.5-turbo",
|
84 |
messages=[
|
85 |
+
{"role": "system", "content": "You are a very professional article editor."},
|
86 |
+
{"role": "user", "content": "I have a raw article that contains a lot of unnecessary data such as ads, website information, and article publishers, as well as links to other pages, and so on. Please clean up the article I provided so that only the article's content remains." + art + "\nDo not write any explanation and any pleasantries. Please use the following complete format to display the output: {the cleaned article's content}"}
|
87 |
+
],
|
88 |
temperature = 0.1
|
89 |
)
|
90 |
finish_reason = response['choices'][0]['finish_reason']
|
91 |
if finish_reason == 'length' or finish_reason == 'stop':
|
92 |
result = response['choices'][0]['message']['content']
|
93 |
+
new_artikel.append(result)
|
|
|
|
|
94 |
|
95 |
+
new_art = [' '.join(new_artikel)]
|
96 |
+
for art in new_art:
|
|
|
|
|
|
|
97 |
response = openai.ChatCompletion.create(
|
98 |
model ="gpt-3.5-turbo",
|
99 |
messages=[
|
100 |
+
{"role": "system", "content": "You are a very professional article editor and capable of generating compelling and professional article titles."},
|
101 |
+
{"role": "user", "content": "Paraphrase the above article to make it a well-written and easily understandable piece for humans, following the conventions of renowned articles. \nThen, You Must Generate a title that is appropriate for the article I provided. The title should be professional, similar to typical article titles and sound more natural for a human to read" + art + "\nDo not write any explanation and any pleasantries. Please use the following complete format to display the output: title:{title}, article: {new paraphrased article}"}
|
102 |
+
],
|
103 |
+
temperature = 0.1
|
104 |
)
|
105 |
+
finish_reason = response['choices'][0]['finish_reason']
|
106 |
+
if finish_reason == 'length' or finish_reason == 'stop':
|
107 |
+
result = response['choices'][0]['message']['content']
|
108 |
+
article.append(result)
|
109 |
+
|
110 |
+
content = article[0].split("\n")
|
111 |
+
title = content[0].replace('title:', '').replace("Title:", '').strip(
|
112 |
+
response = openai.ChatCompletion.create(
|
113 |
+
model ="gpt-3.5-turbo",
|
114 |
+
messages=[
|
115 |
+
{"role": "system", "content": "You are a professional translator and rewriter"},
|
116 |
+
{"role": "user", "content": "Please translate and rewrite this sentence into Indonesian language with the following requirements: \n1. The sentence should be concise, compact, and clear. \n2. The sentence length should not exceed 50 characters. \n3. The sentences should be professional, similar to typical article titles and sound more natural for a human to read.:" +title+"\nDo not write any explanation and any pleasantries. Please use the following complete format to display the output: Judul:{hasil rewrite}"}
|
117 |
+
],
|
118 |
+
temperature = 0
|
119 |
+
)
|
120 |
+
judul = response['choices'][0]['message']['content']
|
121 |
judul = judul.replace("Judul:", '').strip()
|
122 |
judul = judul.replace("Title:", '').strip()
|
123 |
try:
|
|
|
175 |
post_article = []
|
176 |
|
177 |
for i in artikel:
|
178 |
+
response = openai.ChatCompletion.create(
|
179 |
+
model ="gpt-3.5-turbo",
|
180 |
+
messages=[
|
181 |
+
{"role": "system", "content": "You are a proficient English to Indonesian language translator machine. You are capable of translating professionally according to the rules of the Indonesian language"},
|
182 |
+
{"role": "user", "content": "Translate the following article into Indonesian language. Then, you must resume the article translated. The translated result should be more than 2500 characters and less than 7000 characters.: " + i + "\nDo not write any explanation and any pleasantries. Please use the following complete format to display the output: {Professionally rewritten content}"}
|
183 |
+
],
|
184 |
+
temperature = 0
|
185 |
+
)
|
186 |
+
finish_reason = response['choices'][0]['finish_reason']
|
187 |
+
if finish_reason == 'length' or finish_reason == 'stop':
|
188 |
+
translate = response['choices'][0]['message']['content']
|
189 |
+
translated.append(translate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
time.sleep(2)
|
191 |
+
|
192 |
+
for i in translated:
|
193 |
+
response = openai.ChatCompletion.create(
|
194 |
+
model ="gpt-3.5-turbo",
|
195 |
+
messages=[
|
196 |
+
{"role": "system", "content": """You are a very professional article editor and perform SEO optimization on an article with utmost professionalism. berikut adalah SOP SEO yang harus kamu terapkan
|
197 |
+
1. meta decription max 160 characters
|
198 |
+
2. title max 60 characters
|
199 |
+
3. sentences max 20 words
|
200 |
+
4. paragraph max 300 words
|
201 |
+
5. sebisa mungkin focus keyword harus ada di title, bagian depan (sifatnya "sebisa mungkin". Kalau tidak bisa, di bagian manapun tidak masalah)
|
202 |
+
6. focus keyword harus ada di content
|
203 |
+
7. focus keyword harus ada di intro
|
204 |
+
8. focus keyword harus ada di meta desc
|
205 |
+
9. focus keyword harus ada di url
|
206 |
+
10. focus keyword harus ada di intro
|
207 |
+
"""},
|
208 |
+
{"role": "user", "content": "Paraphrase the above article to make it a well-written and easily understandable piece for humans, following the conventions of renowned articles.The paraphrased result should be more than 2500 characters and less than 7000 characters. and then perform SEO optimization on the following article:\n" + i + "\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: {reformatted article}"}
|
209 |
+
],
|
210 |
+
temperature = 0
|
211 |
+
)
|
212 |
+
SEO = response['choices'][0]['message']['content']
|
213 |
+
optimized.append(SEO)
|
214 |
+
time.sleep(2)
|
215 |
+
|
216 |
for i in optimized:
|
217 |
+
response = openai.ChatCompletion.create(
|
218 |
+
model ="gpt-3.5-turbo",
|
219 |
+
messages=[
|
220 |
+
{"role": "system", "content": f"""
|
221 |
+
You are a professional article writer and editor. I have an article that needs your editing expertise to align its writing style with specific instructions and guidelines:
|
222 |
+
1. Theme and Title: The blog article should have a clear and informative title that reflects the main topic.
|
223 |
+
2. Writing Style: The writing style in the blog article should appear serious, informative, and academic. It should use formal language to convey the importance of the discussed topic. Sentences should be long and rich in information.
|
224 |
+
3. Use of Data and Statistics: The blog article should support its arguments with concrete data and statistics.
|
225 |
+
4. Tone and Emotion: Despite the seriousness of the topic, the blog should not be overly emotional in its delivery. You should focus more on presenting facts and analysis rather than creating an emotional effect.
|
226 |
+
5. Subheadings: The use of subheadings should help readers follow the flow of the article and understand key points more easily.
|
227 |
+
6. Citations and Sources: The blog should cite reliable sources.
|
228 |
+
7. Graphics: The blog should use graphics to visualize data clearly.
|
229 |
+
8. SEO Keywords: Use keywords that will help the blog become more discoverable in search results.
|
230 |
+
9. Conclusion: The blog should also have a clear conclusion that summarizes the core findings of the study.
|
231 |
+
10. Final Thought: You should conclude the blog by providing readers with broader insights on the topic.
|
232 |
+
11. meta decription max 160 characters
|
233 |
+
12. title max 60 characters
|
234 |
+
13. sentences max 20 words
|
235 |
+
14. paragraph max 300 words
|
236 |
+
15. sebisa mungkin focus keyword harus ada di title, bagian depan (sifatnya "sebisa mungkin". Kalau tidak bisa, di bagian manapun tidak masalah)
|
237 |
+
16. focus keyword harus ada di content
|
238 |
+
17. focus keyword harus ada di intro
|
239 |
+
18. focus keyword harus ada di meta desccripton
|
240 |
+
19. focus keyword harus ada di url
|
241 |
+
20. focus keyword harus ada di intro
|
242 |
+
|
243 |
+
Here is the article that you need to edit to adhere to these 20 criteria: {i}
|
244 |
+
Please do not change the existing format in the article, just adjust the writing style according to the 10 criteria I mentioned.
|
245 |
+
""" },
|
246 |
+
{"role": "user", "content": "Please ensure the usage of proper and correct Indonesian language. \nDo not write any explanation and any pleasantries. Provide only the rewrited article using this format: {rewrited article}"}
|
247 |
+
],
|
248 |
+
temperature = 0
|
249 |
+
)
|
250 |
+
result = response['choices'][0]['message']['content']
|
251 |
+
article.append(result)
|
252 |
+
time.sleep(2)
|
253 |
+
|
|
|
|
|
|
|
|
|
|
|
254 |
for i in article:
|
255 |
+
response = openai.ChatCompletion.create(
|
256 |
+
model ="gpt-3.5-turbo",
|
257 |
+
messages=[
|
258 |
+
{"role": "system", "content": "You are a professional article editor machine."},
|
259 |
+
{"role": "user", "content": "Please rewrite the given article in the style of a professional writer for Forbes or The New York Times with bahasa indonesia as your native language:\n\n" + i + "\nAdd underline tags <u> and bold tags <b> to all foreign terms (non-Indonesian words) you encounter. You only have less than 7 attempts to do this, no more than that in order to keep the article neat and clean. \nThen, You must divide the article into several paragraphs, no less than 3 paragraphs. kamu juga harus membuat subheading menggunakan <h2> pada setiap sub topik pembahasan \n\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:<h2>A brief headline of the article content</h2> <p>reformatted article</p>"}
|
260 |
+
],
|
261 |
+
temperature = 0
|
262 |
+
)
|
263 |
+
font_formatted = response['choices'][0]['message']['content']
|
264 |
+
edited_format.append(font_formatted)
|
265 |
+
time.sleep(2)
|
266 |
+
|
|
|
|
|
|
|
|
|
|
|
267 |
for i in edited_format:
|
268 |
+
response = openai.ChatCompletion.create(
|
269 |
+
model ="gpt-3.5-turbo",
|
270 |
+
messages=[
|
271 |
+
{"role": "system", "content": "You are a professional article editor machine."},
|
272 |
+
{"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 'AI,' 'chatbot,' and 'omnichannel,' 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}"}
|
273 |
+
],
|
274 |
+
temperature = 0
|
275 |
+
)
|
276 |
+
artikel_post = response['choices'][0]['message']['content']
|
277 |
+
post_article.append(artikel_post)
|
278 |
+
time.sleep(2)
|
279 |
+
|
|
|
|
|
|
|
|
|
280 |
meta_keywords = '<!-- wp:html –><meta name=”keywords” content=”chabot indonesia, chabot ai, bot master, artificial intelligence,ai, easy manage chatbot, bot ai,integration chatbot, chatbot online,ai chatbot, chatbot gpt, wizard gpt”><!-- /wp:html –->'
|
281 |
post_article.append(meta_keywords)
|
282 |
content = ''.join(post_article)
|
|
|
289 |
|
290 |
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
291 |
def generate_image_prompt(title):
|
|
|
292 |
try:
|
293 |
response = openai.ChatCompletion.create(
|
294 |
model="gpt-3.5-turbo", # engine = "deployment_name".
|
|
|
431 |
# selected_columns = result.loc[:, "Judul Artikel":"tags"]
|
432 |
return result,image
|
433 |
|
434 |
+
@retry(openai.error.OpenAIError, tries=10, delay=10)
|
435 |
def scrap(link_scrap,backlink,keyword,openai_key,replicate_key):
|
436 |
+
openai.api_key = openai_key
|
437 |
try:
|
438 |
+
data,gambar= artikel_processing(link_scrap,backlink,keyword,replicate_key)
|
439 |
judul = data['Judul Artikel'][0]
|
440 |
kontent = data["Konten Artikel"][0]
|
441 |
return gambar,judul,kontent
|
442 |
+
except openai.error.OpenAIError as e:
|
443 |
gambar = Image.open('error.png')
|
444 |
judul = 'Gagal Generate Judul:Request Time Out'
|
445 |
kontent = 'Gagal Generate Artikel:Request Time Out'
|