File size: 644 Bytes
3842626
f891fe9
2feb5bd
b1ec0a0
3842626
b1ec0a0
 
f891fe9
b1ec0a0
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# import gradio as gr

# pip install langchain[all]
import os
os.environ["HUGGINGFACEHUB_API_TOKEN"] = "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"
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
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_chain.run(question))

# def greet(name):
#     return "Hello " + name + "!!"

# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
# iface.launch()