awinml commited on
Commit
54d056b
β€’
1 Parent(s): c1de521

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -1,16 +1,12 @@
1
  import gradio as gr
2
  from llama_cpp import Llama
3
 
4
-
5
 
6
  def generate_text(prompt):
7
- llm = Llama(model_path="eachadea_ggml-vic7b-q4_0.bin", n_ctx=2048)
8
  output = llm(prompt, max_tokens=468, temperature=0.1, top_p=0.5, echo=False, stop=["#"])
9
- text = output['choices'][0]['text']
10
- return text
11
-
12
- input_text = gr.Textbox(lines= 10, label="Enter your input text")
13
- output_text = gr.Textbox(label="Output text")
14
 
15
  description = "Vicuna-7B-GPTQ-4bit-128g.GGML, max_tokens=468, temperature=0.1, top_p=0.5"
16
 
@@ -20,4 +16,10 @@ examples = [
20
  ["What is the square root of 64?", "The square root of 64 is 8."]
21
  ]
22
 
23
- demo = gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Vicuna Language Model", description=description).launch()
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from llama_cpp import Llama
3
 
4
+ llm = Llama(model_path="eachadea_ggml-vic7b-q4_0.bin", n_ctx=2048)
5
 
6
  def generate_text(prompt):
 
7
  output = llm(prompt, max_tokens=468, temperature=0.1, top_p=0.5, echo=False, stop=["#"])
8
+ output_text = output['choices'][0]['text']
9
+ return output_text
 
 
 
10
 
11
  description = "Vicuna-7B-GPTQ-4bit-128g.GGML, max_tokens=468, temperature=0.1, top_p=0.5"
12
 
 
16
  ["What is the square root of 64?", "The square root of 64 is 8."]
17
  ]
18
 
19
+ gradio_interface = gr.Interface(
20
+ fn=generate_text,
21
+ inputs="text",
22
+ outputs="text",
23
+ title="Vicuna API",
24
+ )
25
+ gradio_interface.launch()