Spaces:
Sleeping
Sleeping
File size: 946 Bytes
ed2f45f 5431aa0 ed2f45f 68c2e38 ed2f45f 1df245c ed2f45f |
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 27 28 29 |
import os
os.system('CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python==0.1.62')
import gradio as gr
from llama_cpp import Llama
llm = Llama(model_path="Wizard-Vicuna-13B-Uncensored.ggmlv3.q4_0", n_ctx=2048, n_batch=126)
def generate_text(prompt):
output = llm(prompt, max_tokens=468, temperature=0.1, top_p=0.5, echo=False, stop=["#"])
output_text = output['choices'][0]['text']
return output_text
description = "Wizard-Vicuna-13B-Uncensored, 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."]
]
gradio_interface = gr.Interface(
fn=generate_text,
inputs="text",
outputs="text",
title="Vicuna API",
)
gradio_interface.launch() |