Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|