File size: 588 Bytes
573d720
6455886
573d720
 
 
 
 
 
 
 
 
2f9181e
573d720
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
import os
os.environ['HUGGINGFACEHUB_API_TOKEN'] = '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'
llm=HuggingFaceHub(repo_id="google/flan-t5-xxl", model_kwargs={"temperature":1e-10})
template = 'question:{question}'
prompt = PromptTemplate(template=template, input_variables=["question"])
chain = LLMChain(llm=llm, prompt=prompt)
def answer(question):
  out=chain.run(question)
  return out
demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples= [['What is the capital of India ?']])
demo.launch()