llmsintro / app.py
kla2023's picture
Update app.py
5eb3583 verified
raw
history blame contribute delete
No virus
616 Bytes
import streamlit as st
from langchain.llms import HuggingFaceHub
import json
def getAnswer(question):
llm = HuggingFaceHub(repo_id="google/flan-t5-large")
response = llm(question)
return response
st.set_page_config(page_title="LangChain Demo", page_icon=":robot:")
st.header("lang chain demo")
def getQuestion():
question = st.text_input("You: ", key="input")
return question
question = getQuestion()
if st.button('Generate') and question: # Check if Generate button is clicked and question is not empty
response = getAnswer(question)
st.subheader("Answer:")
st.write(response)