habeebb5 commited on
Commit
b1ec0a0
·
1 Parent(s): f891fe9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ pip install langchain[all]
4
+ import os
5
+ os.environ["HUGGINGFACEHUB_API_TOKEN"] = "xxxxxxxxxxxxxxxxxxx"
6
+ from langchain import PromptTemplate, HuggingFaceHub, LLMChain
7
+ template = """Question: {question}
8
 
9
+ Answer: Let's think step by step."""
10
+ prompt = PromptTemplate(template=template, input_variables=["question"])
11
+ llm=HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature":1e-10})
12
+
13
+ question = "When was Google founded?"
14
+
15
+ print(llm_chain.run(question))
16
+
17
+ # def greet(name):
18
+ # return "Hello " + name + "!!"
19
+
20
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
21
+ # iface.launch()