Spaces:
Runtime error
Runtime error
AshtonIsNotHere
commited on
Commit
•
3ff77f2
1
Parent(s):
457bf11
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from llama_cpp import Llama
|
3 |
+
|
4 |
+
model = Llama(model_path="AshtonIsNotHere/CodeLlama_7B_nlp_pp/CodeLlama_7B_nlp_pp_q8_0.gguf")
|
5 |
+
|
6 |
+
def generate(input_text):
|
7 |
+
output = model(input_text, max_tokens=128, stop=["\n"], echo=True)
|
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 |
+
description = "Code generation for NLP++ with CodeLlama"
|
14 |
+
|
15 |
+
examples = [
|
16 |
+
'# Find concept named parent under root and print "num" val for each child attribute\n',
|
17 |
+
'L("iter") = getconcept(findroot(), L("parent_con"));\n',
|
18 |
+
"# Match node _noun when preceded by _noun"
|
19 |
+
]
|
20 |
+
|
21 |
+
gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="CodeLlama for NLP++", description=description, examples=examples).launch()
|