import gradio as gr from fun_advaitbert import predict_CTH from fun_advaitbert import llm_model_function from fun_advaitbert import product_explaination title="

AdvaitBERT:HS Code AI Explanability Through Mixtral 46.7B

" description = """ AdvaitBERT is modified version of BERT (Bidirectional Encoder Representation for Transformers), \ finetuned on the Text corpus of Indian Customs Declarations. It is trained for performing \ downstream tasks like automating the tariff classification and validation process of Customs \ declarations in realtime. This model may help Customs administration to efficiently use AI assisted \ NLP in realtime Customs process like Assessment, Post Clearance Audit, thereby highlighting classification \ inconsistencies and help in revenue augmentation. """ article="

Powered by NCTC

" css = """ .gradio-container { width: 100vw !important; min-height: 100vh !important; padding:0 !important; margin:0 !important; max-width: none !important; } """ footnote = """Note: All rights, including licensing and acceptable use policies, related to the AI models, can be found on their respective model pages on Hugging Face. Powered by NCTC """ #Powered by NCTC # input_txt=gr.Textbox(label='Enter Your Product Descrption',lines=3,) # textbox = gr.Textbox(container=False,placeholder='Enter text and click the Submit button or press Enter') textbox = gr.Textbox(label='Enter Your Product Descrption',lines=3,) textbox_2=textbox print('textbox',textbox) print('textbox_2',textbox_2) chat_prod = gr.Chatbot(label="Product Explanation", layout='panel') #height=300 #chat_Advait = gr.Chatbot(label="Advaitbert Prediction", layout='panel') chat_alpha = gr.Chatbot(label="AI Explanability", layout='panel') chat_Advait=gr.Interface(predict_CTH,inputs=textbox,outputs="label",) submit = gr.Button('Submit', variant='primary',) submit_second = gr.Button('Submit', variant='secondary',) #submit2 = gr.Button('Submit', variant='primary',) retry = gr.Button('🔄Retry', variant='secondary') undo = gr.Button('↩️Undo', variant='secondary') with gr.Blocks(css=css) as demo: gr.HTML(f'

{title}

') gr.Markdown(description) with gr.Row(): with gr.Column(scale=0,min_width=600): chat_Advait.render() with gr.Column(scale=1,min_width=600): chat_alpha.render() with gr.Row(equal_height=True): with gr.Column(scale=1): submit.render() with gr.Column(scale=1): undo.render() with gr.Column(scale=1): clear = gr.ClearButton(value='🗑️Clear',components=[chat_alpha,chat_prod,textbox]) chat_prod.render() #submit_second.render() gr.Markdown(footnote) textbox.submit(llm_model_function, [textbox, chat_alpha], [textbox, chat_alpha]) textbox_2.submit(product_explaination, [textbox_2, chat_prod], [textbox_2, chat_prod]) submit.click(llm_model_function,[textbox, chat_alpha], [textbox, chat_alpha]) submit.click(product_explaination,[textbox_2, chat_prod], [textbox_2, chat_prod]) undo.click(lambda x:x[:-1], [chat_alpha], [chat_alpha]) undo.click(lambda x:x[:-1], [chat_prod], [chat_prod]) gr.Examples([ ['200 SI/SI/SI LPO ALUMINIUM LIDS (QTY: 8820000 PCS/PRICE: 21.'], ], textbox) demo.launch(debug=True)