Huzaifa367 commited on
Commit
331c1b2
·
verified ·
1 Parent(s): 54b4ca2

Upload 3 files

Browse files
Files changed (3) hide show
  1. README (2).md +12 -0
  2. app.py +23 -0
  3. requirements.txt +3 -0
README (2).md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Chat GPT4ALL
3
+ emoji: ⚡
4
+ colorFrom: pink
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ sdk_version: 4.31.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gpt4all import GPT4All
3
+
4
+ model = GPT4All("orca-mini-3b-gguf2-q4_0.gguf")
5
+
6
+ def chatbot_response(input_text):
7
+ tokens = []
8
+ with model.chat_session() as session:
9
+ for token in model.generate(input_text, streaming=True):
10
+ tokens.append(token)
11
+ response = ''.join(tokens)
12
+ return response
13
+
14
+ iface = gr.Interface(
15
+ fn=chatbot_response,
16
+ inputs=gr.components.Textbox(lines=2, placeholder="Ask me anything..."),
17
+ outputs="text",
18
+ title="GPT-4All Chatbot",
19
+ description="This chatbot uses the GPT-4All model to answer your questions."
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gpt4all
2
+ gradio
3
+