Update app.py (#13)
Browse files- Update app.py (54d056b335e6b671d8dfa601aad96e75241744c2)
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 |
-
|
10 |
-
return
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|