Spaces:
Sleeping
Sleeping
import gradio as gr | |
from utils import response_faiss, sub_chunk_query, window_query | |
from pathlib import Path | |
# title = "Vietnam's Enterprise Laws chatbot" | |
description = """ | |
Vietnam's Enterprise Laws Chatbot is an AI-powered tool designed to provide instant, accurate information about corporate laws in Vietnam. | |
Users can ask questions related to company formation, legal compliance, business regulations, and other corporate legal matters. | |
The chatbot offers tailored guidance based on Vietnamese laws, helping businesses and entrepreneurs navigate legal requirements efficiently. | |
""" | |
ROOT_DIR = str(Path(__file__).resolve().parent.parent.resolve()) | |
def load_css(): | |
with open(ROOT_DIR + '/app/css/styles.css', 'r') as file: | |
css_content = file.read() | |
return css_content | |
def load_js(): | |
with open(ROOT_DIR + '/app/css/js.js', 'r') as file: | |
js_content = file.read() | |
return js_content | |
import gradio as gr | |
print(load_js()) | |
# Load external JavaScript file | |
with gr.Blocks(title="Chatbot Viet's Corporate Laws", css=load_css(), theme="default", js=load_js()) as demo: | |
with gr.Row(elem_classes="header"): | |
gr.Image(f"{ROOT_DIR}/app/assets/logo.png", | |
elem_classes="logo-image", interactive=False, container=False, | |
show_share_button=False, show_download_button=False, | |
show_fullscreen_button=False, show_label=False) | |
# gr.Markdown(f"{title}", elem_classes="title") | |
# Add the description with a new class for styling | |
gr.Markdown(f"{description}", elem_classes="description") | |
gr.ChatInterface( | |
# response_faiss, | |
window_query, | |
# type="messages",#https://www.gradio.app/docs/gradio/chatbot | |
title=None, | |
description = None, | |
chatbot=gr.Chatbot(bubble_full_width = True), | |
# multimodal = True, | |
examples=[ | |
'Chào bán cổ phần cho cổ đông hiện hữu của công ty cổ phần không phải là công ty đại chúng được thực hiện ra sao ?', | |
'Quyền của doanh nghiệp là những quyền nào?', | |
'Các trường hợp nào được coi là tên gây nhầm lẫn ?', | |
'Các quy định về chào bán trái phiếu riêng lẻ', | |
'Doanh nghiệp có quyền và nghĩa vụ như thế nào?', | |
'Xin chào! Tôi muốn hỏi về các quy định khi thành lập doanh nghiệp tư nhân ở Việt Nam.' | |
] | |
) | |
if __name__ == "__main__": | |
# response_faiss("Chào bán cổ phần cho cổ đông hiện hữu của công ty cổ phần không phải là công ty đại chúng được thực hiện ra sao ?", "") | |
print('main') | |
demo.launch(share = True) |