Code Generation

from onprem import LLM

url = "https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGUF/resolve/main/codeup-llama-2-13b-chat-hf.Q4_K_M.gguf"
llm = LLM(url, n_gpu_layers=-1)
template = """
Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:
{prompt}

### Response:"""
answer = llm.prompt(
    "Write a Python script that returns all file paths from a folder recursively.",
    prompt_template=template,
)

Here's a Python script that does just that! To use it, simply replace `folder_path` with the path to the folder you want to search.
```python
import os

def get_file_paths(folder_path):
    file_paths = []
    for root, dirs, files in os.walk(folder_path):
        for file in files:
            file_paths.append(os.path.join(root, file))
    return file_paths

print(get_file_paths("path/to/folder"))
```
This script uses the `os` module's `walk()` function to recursively explore the folder and collect all files. The `os.path.join()` function is used to join each file path with its parent directory, and return a list of all file paths. To use this script, simply replace `folder_path` with the path to the folder you want to search.

from IPython.display import Markdown as md

md(answer)

Here’s a Python script that does just that! To use it, simply replace folder_path with the path to the folder you want to search.

import os

def get_file_paths(folder_path):
    file_paths = []
    for root, dirs, files in os.walk(folder_path):
        for file in files:
            file_paths.append(os.path.join(root, file))
    return file_paths

print(get_file_paths("path/to/folder"))

This script uses the os module’s walk() function to recursively explore the folder and collect all files. The os.path.join() function is used to join each file path with its parent directory, and return a list of all file paths. To use this script, simply replace folder_path with the path to the folder you want to search.