GPT4ALL / app.py
Huzaifa367's picture
Update app.py
1163578 verified
raw
history blame contribute delete
635 Bytes
import gradio as gr
from gpt4all import GPT4All
model = GPT4All("orca-mini-3b-gguf2-q4_0.gguf")
def chatbot_response(input_text):
tokens = []
with model.chat_session() as session:
for token in model.generate(input_text, streaming=True):
tokens.append(token)
response = ''.join(tokens)
return response
iface = gr.Interface(
fn=chatbot_response,
inputs=gr.components.Textbox(lines=2, placeholder="Ask me anything..."),
outputs="text",
title="GPT4All",
description="This chatbot uses the GPT-4All model to answer your questions."
)
if __name__ == "__main__":
iface.launch()