File size: 959 Bytes
9202a4a e1f6636 9202a4a 1d74b68 e1f6636 1d74b68 9202a4a 4b7a4d8 9202a4a 1d74b68 9202a4a b727c35 9202a4a 72facea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
from llama_cpp import Llama
def generate_text(prompt):
llm = Llama(model_path="vicuna-AlekseyKorshuk-7B-GPTQ-4bit-128g.GGML.bin", n_ctx=2048)
output = llm(prompt, max_tokens=468, temperature=0.1, top_p=0.5, echo=False, stop=["#"])
text = output['choices'][0]['text']
return text
input_text = gr.Textbox(lines= 10, label="Enter your input text")
output_text = gr.Textbox(label="Output text")
description = "Vicuna-7B-GPTQ-4bit-128g.GGML, max_tokens=468, temperature=0.1, top_p=0.5"
examples = [
["What is the capital of France? ", "The capital of France is Paris."],
["Who wrote the novel 'Pride and Prejudice'?", "The novel 'Pride and Prejudice' was written by Jane Austen."],
["What is the square root of 64?", "The square root of 64 is 8."]
]
demo = gr.Interface(fn=generate_text, inputs=input_text, outputs=output_text, title="Vicuna Language Model", description=description)
demo.launch(share=True)
|