File size: 526 Bytes
51ceb3f
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
llm=HuggingFaceHub(repo_id="tiiuae/falcon-7b")
template = 'question:{question}'
prompt = PromptTemplate(template=template, input_variables=["question"])
chain = LLMChain(llm=llm, prompt=prompt)
def answer(question):
  out=chain.run(question)
  out=chain.run(question)
  out1= out.splitlines()
  out2=out1[1]
  return out2
demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples= [['What is the capital of India ?']])
demo.launch()