GPT4ALL_CS_ED / app.py
ashwinR's picture
Create app.py
ea92d7b
raw
history blame
756 Bytes
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()