Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -381,7 +381,16 @@ def ask_question1(query):
|
|
| 381 |
repo_url = f"https://huggingface.co/datasets/manabb/nrl"
|
| 382 |
msg = f"{result}\n\n**π Document Sources:**{source_info}\n\n[View all documents]({repo_url})"
|
| 383 |
return msg
|
| 384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
# Gradio UI
|
| 386 |
with gr.Blocks(title="N R L C H A T B O T - for commercial procurement - Supply", css="""
|
| 387 |
#blue-col { background: linear-gradient(135deg, #667eea, #764ba2); padding: 20px; border-radius: 10px; }
|
|
@@ -434,11 +443,13 @@ with gr.Blocks(title="N R L C H A T B O T - for commercial procurement - Supply"
|
|
| 434 |
with gr.Row():
|
| 435 |
file_input = gr.File(label="π Upload .pdf File by only authorized user", type="filepath")
|
| 436 |
with gr.Row():
|
| 437 |
-
|
| 438 |
-
with gr.Row():
|
| 439 |
-
authorized_user=gr.Textbox(label="Write the password to upload new Circular Doc.")
|
| 440 |
with gr.Row():
|
|
|
|
| 441 |
upload_btn.click(upload_and_prepare, inputs=[file_input,authorized_user], outputs=output_msg)
|
|
|
|
|
|
|
|
|
|
| 442 |
|
| 443 |
|
| 444 |
|
|
|
|
| 381 |
repo_url = f"https://huggingface.co/datasets/manabb/nrl"
|
| 382 |
msg = f"{result}\n\n**π Document Sources:**{source_info}\n\n[View all documents]({repo_url})"
|
| 383 |
return msg
|
| 384 |
+
#===============================================
|
| 385 |
+
#delete entire repo
|
| 386 |
+
def delete_entire_repo(user):
|
| 387 |
+
mx="Unauthorized user."
|
| 388 |
+
if user == os.getenv("uploading_password"):
|
| 389 |
+
api = HfApi(token=os.getenv("HF_TOKEN"))
|
| 390 |
+
api.delete_repo(repo_id=os.getenv("reposit_id"), repo_type="dataset")
|
| 391 |
+
mx=f"ποΈ Entire repo {repo_id} deleted. Create new one."
|
| 392 |
+
return mx
|
| 393 |
+
#===============================================
|
| 394 |
# Gradio UI
|
| 395 |
with gr.Blocks(title="N R L C H A T B O T - for commercial procurement - Supply", css="""
|
| 396 |
#blue-col { background: linear-gradient(135deg, #667eea, #764ba2); padding: 20px; border-radius: 10px; }
|
|
|
|
| 443 |
with gr.Row():
|
| 444 |
file_input = gr.File(label="π Upload .pdf File by only authorized user", type="filepath")
|
| 445 |
with gr.Row():
|
| 446 |
+
authorized_user=gr.Textbox(label="Write the password to upload new Circular Doc.")
|
|
|
|
|
|
|
| 447 |
with gr.Row():
|
| 448 |
+
upload_btn = gr.Button("π Process Doc")
|
| 449 |
upload_btn.click(upload_and_prepare, inputs=[file_input,authorized_user], outputs=output_msg)
|
| 450 |
+
with gr.Row():
|
| 451 |
+
upload_btn = gr.Button("π Delete complete repo")
|
| 452 |
+
upload_btn.click(delete_entire_repo, inputs=authorized_user, outputs=output_msg)
|
| 453 |
|
| 454 |
|
| 455 |
|