Spaces:
Runtime error
Runtime error
Download app.py from BrodyMakezAI/DCL2: direct link, hf CLI and curl.
- Browser
- Download file 480 Bytes
-
https://huggingface.co/spaces/BrodyMakezAI/DCL2/resolve/main/app.py
- Command line
-
hf download hf://spaces/BrodyMakezAI/DCL2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/BrodyMakezAI/DCL2/resolve/main/app.py
480 Bytes
| from llama_cpp import Llama | |
| import gradio as gr | |
| llm = Llama(model_path="dcl2.gguf", n_ctx=256) | |
| def generate(prompt, max_tokens): | |
| output = llm(prompt, max_tokens=int(max_tokens), stop=["</s>"]) | |
| return output["choices"][0]["text"] | |
| demo = gr.Interface( | |
| fn=generate, | |
| inputs=[ | |
| gr.Textbox(label="Prompt"), | |
| gr.Slider(1, 200, value=50, label="Max tokens"), | |
| ], | |
| outputs=gr.Textbox(label="Output"), | |
| title="dcl2 (custom GPT-2)", | |
| ) | |
| demo.launch() |