amirbux's picture
app.py
8cde5ff verified
raw
history blame contribute delete
649 Bytes
streamlit>=1.25
langchain
huggingface_hub
transformers
import streamlit as st
from langchain.llms import HuggingFaceHub
from langchain import PromptTemplate, LLMChain
st.title("🤖 Quest AI Assistant")
template = """
You are a helpful AI assistant.
User question: {question}
"""
prompt = PromptTemplate(input_variables=["question"], template=template)
llm = HuggingFaceHub(
repo_id="google/flan-t5-large",
model_kwargs={"temperature": 0.5, "max_length": 256}
)
chain = LLMChain(prompt=prompt, llm=llm)
question = st.text_input("Ask something:")
if st.button("Get Answer"):
response = chain.run(question)
st.write(response)