Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -216,7 +216,7 @@ def scrap_artikel(source_type,source,models,api_key,azure_api_base,keyword):
|
|
| 216 |
|
| 217 |
if source_type == "keyword":
|
| 218 |
artikel =[]
|
| 219 |
-
URL =
|
| 220 |
link = scrap_portal(source)
|
| 221 |
for url in link:
|
| 222 |
if cek_url(url):
|
|
@@ -538,15 +538,14 @@ def artikel_processing(source_type,source,backlink,keyword,models,api_key,azure_
|
|
| 538 |
return image
|
| 539 |
|
| 540 |
def scrap(source_type,source,backlink,keyword,version,api_key,azure_api_base,replicate_key):
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
# return status,gambar
|
| 550 |
|
| 551 |
def post(endpoint,endpoint_media,username,password,tags,categories,metode):
|
| 552 |
credentials = base64.b64encode(f"{username}:{password}".encode("utf-8")).decode("utf-8")
|
|
|
|
| 216 |
|
| 217 |
if source_type == "keyword":
|
| 218 |
artikel =[]
|
| 219 |
+
URL = ""
|
| 220 |
link = scrap_portal(source)
|
| 221 |
for url in link:
|
| 222 |
if cek_url(url):
|
|
|
|
| 538 |
return image
|
| 539 |
|
| 540 |
def scrap(source_type,source,backlink,keyword,version,api_key,azure_api_base,replicate_key):
|
| 541 |
+
try:
|
| 542 |
+
gambar = artikel_processing(source_type,source,backlink,keyword,version,api_key,azure_api_base,replicate_key)
|
| 543 |
+
status = "<h3>Berhasil Generate Artikel</h3>"
|
| 544 |
+
return status,gambar
|
| 545 |
+
except:
|
| 546 |
+
status = "<h3>Gagal Generate Artikel</h3>"
|
| 547 |
+
gambar = Image.open('error.png')
|
| 548 |
+
return status,gambar
|
|
|
|
| 549 |
|
| 550 |
def post(endpoint,endpoint_media,username,password,tags,categories,metode):
|
| 551 |
credentials = base64.b64encode(f"{username}:{password}".encode("utf-8")).decode("utf-8")
|