Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,6 +70,26 @@ base_replacements = {
|
|
| 70 |
'Aplikasi pesan':'Message app'
|
| 71 |
}
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
def clean_scrap(artikel,link, models):
|
| 74 |
new_artikel = []
|
| 75 |
article = []
|
|
@@ -413,26 +433,6 @@ def scrap(link_scrap,backlink,keyword,version,api_key,azure_api_base,replicate_k
|
|
| 413 |
openai.api_base = azure_api_base
|
| 414 |
openai.api_key = api_key
|
| 415 |
|
| 416 |
-
def get_openai_response(messages):
|
| 417 |
-
response = openai.ChatCompletion.create(
|
| 418 |
-
model="gpt-3.5-turbo",
|
| 419 |
-
messages=messages,
|
| 420 |
-
temperature=0
|
| 421 |
-
)
|
| 422 |
-
finish_reason = response['choices'][0]['finish_reason']
|
| 423 |
-
if finish_reason == 'length' or finish_reason == 'stop':
|
| 424 |
-
return response['choices'][0]['message']['content']
|
| 425 |
-
|
| 426 |
-
def get_azure_response(messages):
|
| 427 |
-
response = openai.ChatCompletion.create(
|
| 428 |
-
engine="gpt-35-turbo",
|
| 429 |
-
messages=messages,
|
| 430 |
-
temperature = 0
|
| 431 |
-
)
|
| 432 |
-
finish_reason = response['choices'][0]['finish_reason']
|
| 433 |
-
if finish_reason == 'length' or finish_reason == 'stop':
|
| 434 |
-
return response['choices'][0]['message']['content']
|
| 435 |
-
|
| 436 |
judul,kontent,gambar, image_data= artikel_processing(link_scrap,backlink,keyword,version)
|
| 437 |
desired_timezone = pytz.timezone('Asia/Jakarta')
|
| 438 |
current_time = datetime.datetime.now(desired_timezone)
|
|
|
|
| 70 |
'Aplikasi pesan':'Message app'
|
| 71 |
}
|
| 72 |
|
| 73 |
+
def get_openai_response(messages):
|
| 74 |
+
response = openai.ChatCompletion.create(
|
| 75 |
+
model="gpt-3.5-turbo",
|
| 76 |
+
messages=messages,
|
| 77 |
+
temperature=0
|
| 78 |
+
)
|
| 79 |
+
finish_reason = response['choices'][0]['finish_reason']
|
| 80 |
+
if finish_reason == 'length' or finish_reason == 'stop':
|
| 81 |
+
return response['choices'][0]['message']['content']
|
| 82 |
+
|
| 83 |
+
def get_azure_response(messages):
|
| 84 |
+
response = openai.ChatCompletion.create(
|
| 85 |
+
engine="gpt-35-turbo",
|
| 86 |
+
messages=messages,
|
| 87 |
+
temperature = 0
|
| 88 |
+
)
|
| 89 |
+
finish_reason = response['choices'][0]['finish_reason']
|
| 90 |
+
if finish_reason == 'length' or finish_reason == 'stop':
|
| 91 |
+
return response['choices'][0]['message']['content']
|
| 92 |
+
|
| 93 |
def clean_scrap(artikel,link, models):
|
| 94 |
new_artikel = []
|
| 95 |
article = []
|
|
|
|
| 433 |
openai.api_base = azure_api_base
|
| 434 |
openai.api_key = api_key
|
| 435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
judul,kontent,gambar, image_data= artikel_processing(link_scrap,backlink,keyword,version)
|
| 437 |
desired_timezone = pytz.timezone('Asia/Jakarta')
|
| 438 |
current_time = datetime.datetime.now(desired_timezone)
|