File size: 616 Bytes
68aae95 bfa320b 68aae95 9b58cbf 7d23cc9 5eb3583 9b58cbf 68aae95 9b58cbf bfa320b 7ce62c7 68aae95 bfa320b 9b58cbf bfa320b 9b58cbf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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)
|