Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -523,52 +523,26 @@ def scrap(source_type,source,backlink,keyword,version,api_key,azure_api_base,rep
|
|
523 |
repo_type="space",
|
524 |
token="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",
|
525 |
)
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
time.sleep(60)
|
547 |
-
return status,gambar
|
548 |
-
|
549 |
-
else:
|
550 |
-
with open('log_activity.txt', 'r') as file:
|
551 |
-
existing_data = file.read()
|
552 |
-
|
553 |
-
log = url + "\n"
|
554 |
-
|
555 |
-
combined_data = existing_data + log
|
556 |
-
|
557 |
-
with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
|
558 |
-
temp_file.write(combined_data)
|
559 |
-
|
560 |
-
|
561 |
-
repo_name = get_full_repo_name(model_id="Article_Gen4", token="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")
|
562 |
-
file_url = upload_file(
|
563 |
-
path_or_fileobj=temp_file.name,
|
564 |
-
path_in_repo="log_activity.txt",
|
565 |
-
repo_id=repo_name,
|
566 |
-
repo_type="space",
|
567 |
-
token="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",
|
568 |
-
)
|
569 |
-
status = "<h3>Gagal Generate Artikel, Coba Generate Ulang atau Ganti Input Source</h3>"
|
570 |
-
gambar = Image.open("error.png")
|
571 |
-
return status,gambar
|
572 |
# except:
|
573 |
# status = "<h3>Gagal Generate Artikel</h3>"
|
574 |
# gambar = Image.open('error.png')
|
|
|
523 |
repo_type="space",
|
524 |
token="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",
|
525 |
)
|
526 |
+
with open('log_activity.txt', 'r') as file:
|
527 |
+
existing_data = file.read()
|
528 |
+
|
529 |
+
log = url + "\n"
|
530 |
+
|
531 |
+
combined_data = existing_data + log
|
532 |
+
|
533 |
+
with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
|
534 |
+
temp_file.write(combined_data)
|
535 |
+
|
536 |
+
file_url = upload_file(
|
537 |
+
path_or_fileobj=temp_file.name,
|
538 |
+
path_in_repo="log_activity.txt",
|
539 |
+
repo_id=repo_name,
|
540 |
+
repo_type="space",
|
541 |
+
token="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",
|
542 |
+
)
|
543 |
+
status = "<h3>Berhasil Generate Artikel</h3>"
|
544 |
+
time.sleep(60)
|
545 |
+
return status,gambar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
# except:
|
547 |
# status = "<h3>Gagal Generate Artikel</h3>"
|
548 |
# gambar = Image.open('error.png')
|