import streamlit as st import codecs import streamlit.components.v1 as stc import pathlib def stc_chatbot(root_dir, width=700, height=600): html_file = root_dir/"app/chatbot.html" css_file = root_dir/"app/css/chatbot.css" js_file = root_dir/"app/js/chatbot.js" if css_file.exists() and js_file.exists(): html = codecs.open(html_file, "r").read() css = codecs.open(css_file, "r").read() js = codecs.open(js_file, "r").read() html = html.replace('', "") html = html.replace('', "") stc.html(html, width=width, height=height, scrolling=False) st.header("English and Indonesian Persona Chatbot") description = f"This application uses the Indonesian GPT2 model; we finetuned it with the original English persona " \ f"dataset and its Indonesian translation. It gives the chatbot the capability to understand and talk " \ f"in both languages (code-switching). The finetuning is based on the Huggingface's Conversational AI " \ f"with Transfer Learning." st.markdown(description) root_dir = pathlib.Path(".") stc_chatbot(root_dir)