Quickest way to build your own chatGPT like website

bedy kharisma
Data And Beyond
Published in
1 min readMay 15, 2023

--

Wanna build something like this?

  1. Clone the app-starter-kit repo and use it as a template to create your chatbot app. Click on “Use this template” and give your repo a name (such as mychatbot).
  2. Edit the requirements.txt file by adding the necessary Python libraries. streamlit hugchat streamlit-chat
  3. Replace the content of the streamlit_app.py file with these 15 lines of code below.
import streamlit as st
from streamlit_chat import message
from hugchat import hugchat
state = st.session_state
state.setdefault('generated', ["I'm HugChat, How may I help you?"])
state.setdefault('past', ['Hi!'])
response_container, input_container = st.columns(2)
user_input = input_container.text_input("You: ", key="input")
if user_input:
response = hugchat.ChatBot().chat(user_input)
state.past.append(user_input)
state.generated.append(response)
for i, (past, generated) in enumerate(zip(state.past, state.generated)):
message(past, is_user=True, key=f"{i}_user")
message(generated, key=str(i))

4. Deploy app at Streamlit Cloud : Get started — Streamlit Docs

This article is inspired by How to build an LLM-powered ChatBot with Streamlit by Data Professor.

--

--

bedy kharisma
Data And Beyond

Indonesian Strategist,Analyst, Researcher, Achievement Addict who helps company grow their business by applying data-driven Management. Follow to follow