File size: 756 Bytes
ea92d7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from langchain import PromptTemplate, LLMChain
from langchain.llms import GPT4All

PATH = 'ggml-mpt-7b-instruct.bin'

llm = GPT4All(model=PATH, verbose=True)

prompt = PromptTemplate(input_variables=['question'], template="""
    Question: {question}
    
    Answer: Let's think step by step.
    """)

llm_chain = LLMChain(prompt=prompt, llm=llm)

def generate_response(question):
    response = llm_chain.run(question)
    return response

inputs = gr.inputs.Textbox(lines=5, label='Enter your prompt here!')
outputs = gr.outputs.Textbox(label='Response')

title = 'πŸ¦œπŸ”— GPT4ALL Y\'All'
description = 'This is using the MPT model!'

gr.Interface(generate_response, inputs, outputs, title=title, description=description).launch()