File size: 733 Bytes
55ec459 ead85ac 55ec459 ead85ac f33c94e ead85ac b4e1632 ead85ac 3766453 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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},huggingfacehub_api_token=HUGGING_FACE_API_KEY)
question = "When was Google founded?"
# print(llm.run(question))
# d=LLMChain(llm=llm,prompt=prompt)
st.write("out",LLMChain.run(question)) |