Spaces:
Runtime error
Runtime error
Commit
·
51ceb3f
1
Parent(s):
caa9c99
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
|
3 |
+
llm=HuggingFaceHub(repo_id="tiiuae/falcon-7b")
|
4 |
+
template = 'question:{question}'
|
5 |
+
prompt = PromptTemplate(template=template, input_variables=["question"])
|
6 |
+
chain = LLMChain(llm=llm, prompt=prompt)
|
7 |
+
def answer(question):
|
8 |
+
out=chain.run(question)
|
9 |
+
out=chain.run(question)
|
10 |
+
out1= out.splitlines()
|
11 |
+
out2=out1[1]
|
12 |
+
return out2
|
13 |
+
demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples= [['What is the capital of India ?']])
|
14 |
+
demo.launch()
|