import streamlit as st | |
import os | |
from langchain import PromptTemplate, HuggingFaceHub, LLMChain | |
x = st.slider('Select a value') | |
st.write(x, 'squared is', x * x) | |
# https://cobusgreyling.medium.com/langchain-creating-large-language-model-llm-applications-via-huggingface-192423883a74 | |
# !pip install langchain[all] | |
template = """Question: {question} | |
Answer: Let's think step by step.""" | |
prompt = PromptTemplate(template=template, input_variables=["question"]) | |
llm=HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature":1e-10}) | |
question = "When was Google founded?" | |
# print(llm.run(question)) | |
# d=LLMChain(llm=llm,prompt=prompt) | |
st.write("out",LLMChain.run(question)) |