ashwinR commited on
Commit
ea92d7b
β€’
1 Parent(s): 64b1bb1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from langchain import PromptTemplate, LLMChain
3
+ from langchain.llms import GPT4All
4
+
5
+ PATH = 'ggml-mpt-7b-instruct.bin'
6
+
7
+ llm = GPT4All(model=PATH, verbose=True)
8
+
9
+ prompt = PromptTemplate(input_variables=['question'], template="""
10
+ Question: {question}
11
+
12
+ Answer: Let's think step by step.
13
+ """)
14
+
15
+ llm_chain = LLMChain(prompt=prompt, llm=llm)
16
+
17
+ def generate_response(question):
18
+ response = llm_chain.run(question)
19
+ return response
20
+
21
+ inputs = gr.inputs.Textbox(lines=5, label='Enter your prompt here!')
22
+ outputs = gr.outputs.Textbox(label='Response')
23
+
24
+ title = 'πŸ¦œπŸ”— GPT4ALL Y\'All'
25
+ description = 'This is using the MPT model!'
26
+
27
+ gr.Interface(generate_response, inputs, outputs, title=title, description=description).launch()