9/5/2023 0 Comments Chatbot website talking head![]() ![]() ![]() St.warning('Please enter your credentials!', icon='⚠️') Hf_pass = st.text_input('Enter password:', type='password') Hf_email = st.text_input('Enter E-mail:', type='password') St.success('HuggingFace Login credentials already provided!', icon='✅') If ('EMAIL' in st.secrets) and ('PASS' in st.secrets): SidebarĬreate a sidebar for accepting Hugging Face authentication credentials: with st.sidebar: Name the app using the page_title input argument in the st.set_page_config method (it'll be used as the app title and as the title in the preview when sharing on social media): st.set_page_config(page_title="□□ HugChat") 3. Import prerequisite Python libraries: import streamlit as stįrom hugchat.login import Login 2. Front-end: Generated responses are displayed in the app via's message() command.įire up the streamlit_app.py file and replace the original content with code snippets mentioned below.Back-end: Input prompt is sent to hugchat (the unofficial port to the HuggingChat API) via streamlit-chat for generating a response.Front-end: The user submits an input prompt (by providing a string of text to the text box via st.text_input()), and the app generates a response.In subsequent sections, you will modify the contents of this file with code snippets about the chatbot.įinally, before proceeding with app building, let's take a look at how the user will interact with it: Let's take a look at the contents of streamlit_app.py: import streamlit as st This will spin up a server with these prerequisites pre-installed. When done, you should be able to see the deployed app:Įdit the requirements.txt file by adding the following prerequisite Python libraries: streamlit Next, follow this blog post to get the newly cloned repo deployed on the Streamlit Community Cloud. Next, click "Create repository from the template." A copy of the repo will be placed in your account: Give the repo a name (such as mychatbot). Set up the app on the Streamlit Community CloudĬlone the app-starter-kit repo to use as the template for creating the chatbot app. Interact with it by (1) entering your prompt into the text input box and (2) reading the human/bot messages. Head over to the app and get familiar with its layout-(1) the Sidebar accepts the login credential, and (2) the Main panel displays conversational messages: What the HugChat app can doīefore we proceed with the tutorial, let's quickly grasp the app's functionality. Want to jump right in? Here's the HugChat app and the GitHub repo. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |