File size: 861 Bytes
55ec459
ead85ac
 
 
55ec459
 
ead85ac
 
 
 
57f9290
73836c2
f33c94e
57f9290
ead85ac
78e5e75
ead85ac
fd64897
e5d5482
ead85ac
 
1e0c25e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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}"""
HUGGING_FACE_API_KEY= os.environ.get("HUGGING_FACE_API_KEY")

Answer= "Let's think step by step."
prompt = PromptTemplate(template=template, input_variables=["question"])
llm=HuggingFaceHub(repo_id="Writer/palmyra-small", model_kwargs={"temperature":1e-10},huggingfacehub_api_token=HUGGING_FACE_API_KEY)

question=st.text_input("Input the question",'')
# question = "When was Google founded?"

# print(llm.run(question))
if question:
    d=LLMChain(llm=llm,prompt=prompt)
    st.write("out",d.run(question))