sam2ai commited on
Commit
1c04c08
1 Parent(s): c42f268

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ llm = Llama(model_path="ggml-alpaca-7b-q4.bin", n_ctx=256, n_batch=128)
5
+
6
+ def generate_text(input_text):
7
+ output = llm(f"{input_text}", max_tokens=128, stop=["Q:", "\n", "#"], echo=False)
8
+ return output['choices'][0]['text']
9
+
10
+ input_text = gr.inputs.Textbox(lines= 10, label="Enter your input text")
11
+ output_text = gr.outputs.Textbox(label="Output text")
12
+
13
+ gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Alpaca GGML").launch()