|
from langchain import HuggingFaceHub |
|
from langchain.schema import HumanMessage,SystemMessage,AIMessage |
|
|
|
from dotenv import load_dotenv |
|
|
|
load_dotenv() |
|
|
|
import streamlit as st |
|
|
|
st.set_page_config(page_title="Chatbot") |
|
st.header('Langchain Application') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_huggingface_response(question): |
|
llm_huggingface=HuggingFaceHub(repo_id="google/flan-t5-large",model_kwargs={"temperature":0.0}) |
|
|
|
|
|
|
|
response = llm_huggingface(question) |
|
|
|
return(response) |
|
|
|
|
|
|
|
|
|
|
|
input=st.text_input("Input: ",key="input") |
|
|
|
response=get_huggingface_response(input) |
|
|
|
|
|
submit=st.button('Generate') |
|
|
|
if submit: |
|
st.subheader("The response is ") |
|
st.write(response) |