Spaces:
Runtime error
Runtime error
Commit
·
18aaf23
1
Parent(s):
d569e5d
inital test commit
Browse files- app.py +21 -0
- ggml-model-f16-q4_0.bin +3 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from llama_cpp import Llama
|
3 |
+
|
4 |
+
MAX_TOKENS = 64
|
5 |
+
|
6 |
+
llm = Llama(model_path="ggml-model-f16-q4_0.bin", n_ctx=2048)
|
7 |
+
|
8 |
+
def generate_text(prompt):
|
9 |
+
output = llm(prompt, max_tokens=MAX_TOKENS, echo=False, stop=["</s>", "\n", "User:"])
|
10 |
+
output_text = output['choices'][0]['text']
|
11 |
+
return output_text
|
12 |
+
|
13 |
+
description = f"txt2tag 13B base model, max_tokens={MAX_TOKENS}"
|
14 |
+
|
15 |
+
gradio_interface = gr.Interface(
|
16 |
+
fn=generate_text,
|
17 |
+
inputs="text",
|
18 |
+
outputs="text",
|
19 |
+
title="txt2tag API",
|
20 |
+
)
|
21 |
+
gradio_interface.launch()
|
ggml-model-f16-q4_0.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43c1bce0a7cf7c9debec8590c144ef2c831db8616704e698110065072a528a32
|
3 |
+
size 7323305088
|