Spaces:
Sleeping
Sleeping
import streamlit as st | |
from langchain.llms import HuggingFaceHub | |
st.set_page_config(page_title="Educational Chatbot") | |
st.title("π Educational Chatbot") | |
user_input = st.text_input("Ask me anything:") | |
if "history" not in st.session_state: | |
st.session_state.history = [] | |
if user_input: | |
llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"temperature": 0.5, "max_new_tokens": 100}) | |
response = llm(user_input) | |
st.session_state.history.append(("You", user_input)) | |
st.session_state.history.append(("Bot", response)) | |
for sender, msg in reversed(st.session_state.history): | |
st.markdown(f"**{sender}:** {msg}") | |