Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,8 @@ from langchain_core.output_parsers import StrOutputParser
|
|
| 18 |
from manabUtils import retrieve_chunks
|
| 19 |
from technicalDocCompliance import compliance_tech, compliance_tech_pdf
|
| 20 |
from MyRules import manualRules
|
|
|
|
|
|
|
| 21 |
|
| 22 |
os.environ["HF_TOKEN"] = os.getenv("HF_TOKEN")
|
| 23 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
|
@@ -305,10 +307,20 @@ def check_compliance_tech(file_name):
|
|
| 305 |
kkk+=generate_html(dd)
|
| 306 |
kkk+="</table>"
|
| 307 |
yield kkk
|
| 308 |
-
update_log("\n Technical Complaince response: "+kkk+"\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
else:
|
| 310 |
yield "Unsupported file format"
|
| 311 |
-
|
| 312 |
|
| 313 |
#================================
|
| 314 |
css = """
|
|
@@ -374,12 +386,17 @@ with gr.Blocks(css=css) as demo:
|
|
| 374 |
out_tech = gr.HTML(label="Compliance Result of technical document")
|
| 375 |
#out = gr.Textbox(lines=15, label="Compliance Result",elem_id="compliance-out")
|
| 376 |
run_btn_tech.click(check_compliance_tech, inputs=inp_tech, outputs=out_tech)
|
| 377 |
-
with gr.TabItem("
|
| 378 |
-
gr.
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
with gr.TabItem("Compliance Check of Draft GeM Tender"):
|
| 384 |
gr.HTML("""
|
| 385 |
<div style="color: white; background: black; padding: 20px; text-align: center; font-size: 24px;">
|
|
|
|
| 18 |
from manabUtils import retrieve_chunks
|
| 19 |
from technicalDocCompliance import compliance_tech, compliance_tech_pdf
|
| 20 |
from MyRules import manualRules
|
| 21 |
+
from CQgenerationOEMImport import compliance_import_OEM
|
| 22 |
+
from manabImportRules import NRLimportRules
|
| 23 |
|
| 24 |
os.environ["HF_TOKEN"] = os.getenv("HF_TOKEN")
|
| 25 |
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
|
|
|
| 307 |
kkk+=generate_html(dd)
|
| 308 |
kkk+="</table>"
|
| 309 |
yield kkk
|
| 310 |
+
update_log("\n Technical Complaince response: "+datetime.now().isoformat()+"\n"+kkk+"\n")
|
| 311 |
+
else:
|
| 312 |
+
yield "Unsupported file format"
|
| 313 |
+
def generateCqOemImport(file_name):
|
| 314 |
+
if file_name.name.endswith(".pdf"):
|
| 315 |
+
MANUAL_RULES = NRLimportRules()
|
| 316 |
+
dd=compliance_import_OEM(file_name, client, MANUAL_RULES)
|
| 317 |
+
kkk="<table>"
|
| 318 |
+
kkk+=generate_html(dd)
|
| 319 |
+
kkk+="</table>"
|
| 320 |
+
yield kkk
|
| 321 |
+
update_log("\n CQ-OEM-Import: "+datetime.now().isoformat()+"\n"+kkk+"\n")
|
| 322 |
else:
|
| 323 |
yield "Unsupported file format"
|
|
|
|
| 324 |
|
| 325 |
#================================
|
| 326 |
css = """
|
|
|
|
| 386 |
out_tech = gr.HTML(label="Compliance Result of technical document")
|
| 387 |
#out = gr.Textbox(lines=15, label="Compliance Result",elem_id="compliance-out")
|
| 388 |
run_btn_tech.click(check_compliance_tech, inputs=inp_tech, outputs=out_tech)
|
| 389 |
+
with gr.TabItem("CQ generation - OEM - IMPORT"):
|
| 390 |
+
with gr.Row():
|
| 391 |
+
inp_OEM_import = gr.File(
|
| 392 |
+
label="Upload vendor's offer in pdf format",
|
| 393 |
+
file_types=[".pdf"],
|
| 394 |
+
elem_id="oem-import-file"
|
| 395 |
+
)
|
| 396 |
+
run_btn_oemImport = gr.Button("Generate CQ of OEM-Import offer", elem_id="generateOEMImport-btn")
|
| 397 |
+
out_tech = gr.HTML(label="Generated CQ")
|
| 398 |
+
#out = gr.Textbox(lines=15, label="Compliance Result",elem_id="compliance-out")
|
| 399 |
+
run_btn_oemImport.click(generateCqOemImport, inputs=inp_OEM_import, outputs=out_tech)
|
| 400 |
with gr.TabItem("Compliance Check of Draft GeM Tender"):
|
| 401 |
gr.HTML("""
|
| 402 |
<div style="color: white; background: black; padding: 20px; text-align: center; font-size: 24px;">
|