chatbot / app.py
wissem29's picture
Upload app.py
bcf4645 verified
raw
history blame contribute delete
750 Bytes
from langchain import HuggingFaceHub
from dotenv import load_dotenv
import streamlit as st
# variable d'environement
load_dotenv()
# HuggingFace model
llm_huggingface = HuggingFaceHub(repo_id="google/flan-t5-large", model_kwargs={"temperature": 0.0, "max_length": 64})
# Streamlit app
st.set_page_config(page_title="Chatbot")
st.header('Langchain Application')
# Function to get responsr
def get_huggingface_response(question):
response = llm_huggingface(question)
return response
# Streamlit input
user_input = st.text_input("Input: ", key="input")
# Streamlit button
submit = st.button('Generate')
if submit:
response = get_huggingface_response(user_input)
st.subheader("The response is ")
st.write(response)