Spaces:
Runtime error
Runtime error
Commit
·
573d720
1
Parent(s):
5be4783
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
rom langchain import PromptTemplate, HuggingFaceHub, LLMChain
|
3 |
+
import os
|
4 |
+
os.environ['HUGGINGFACEHUB_API_TOKEN'] = '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'
|
5 |
+
llm=HuggingFaceHub(repo_id="google/flan-t5-xxl", model_kwargs={"temperature":1e-10})
|
6 |
+
template = 'question:{question}'
|
7 |
+
prompt = PromptTemplate(template=template, input_variables=["question"])
|
8 |
+
chain = LLMChain(llm=llm, prompt=prompt)
|
9 |
+
def answer(question):
|
10 |
+
out=chain.run(question)
|
11 |
+
return out
|
12 |
+
demo = gr.Interface(fn=answer, inputs='text',outputs='text')
|
13 |
+
demo.launch()
|