aarcangeli commited on
Commit
289925a
·
1 Parent(s): 01652e5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gpt4all import GPT4All
2
+ import gradio as gr
3
+
4
+ model = GPT4All("ggml-model-gpt4all-falcon-q4_0.bin")
5
+
6
+ def run_falcon(input_text):
7
+ total_text = input_text
8
+ yield total_text
9
+ for token in model.generate(input_text, max_tokens=1024, streaming=True):
10
+ print(f"Sending {token}")
11
+ total_text += token
12
+ yield total_text
13
+
14
+
15
+ app = gr.Interface(fn=run_falcon, inputs="text", outputs="text")
16
+ app.queue()
17
+ app.launch()