Dataset Viewer
messages
listlengths 2
2
|
---|
[
{
"content": "Write a Python loop that prints numbers 1 to 5.",
"role": "user"
},
{
"content": "for i in range(1, 6):\n print(i)",
"role": "assistant"
}
]
|
[
{
"content": "How can I reverse an array without using built-in methods in JavaScript?",
"role": "user"
},
{
"content": "function reverseArray(arr) {\n let reversed = [];\n for (let i = arr.length - 1; i >= 0; i--) {\n reversed.push(arr[i]);\n }\n return reversed;\n}",
"role": "assistant"
}
]
|
[
{
"content": "Java code to check if a string is a palindrome",
"role": "user"
},
{
"content": "public boolean isPalindrome(String s) {\n String reversed = new StringBuilder(s).reverse().toString();\n return s.equals(reversed);\n}",
"role": "assistant"
}
]
|
[
{
"content": "Give me a Python function that greets a user with a default name.",
"role": "user"
},
{
"content": "def greet(name='World'):\n print(f'Hello, {name}!')",
"role": "assistant"
}
]
|
[
{
"content": "Implement binary search in C++.",
"role": "user"
},
{
"content": "int binarySearch(int arr[], int l, int r, int x) {\n while (l <= r) {\n int m = l + (r - l) / 2;\n if (arr[m] == x) return m;\n if (arr[m] < x) l = m + 1;\n else r = m - 1;\n }\n return -1;\n}",
"role": "assistant"
}
]
|
[
{
"content": "Give me Python code for an AI image generator bot using DreamShaper v8 with Gradio UI that runs on a public server.",
"role": "user"
},
{
"content": "import torch\nfrom diffusers import StableDiffusionPipeline\nimport gradio as gr\n\n# Load the model (make sure you've downloaded DreamShaper v8 from Hugging Face or similar)\nmodel_id = \"Lykon/dreamshaper-8\"\npipeline = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)\npipeline = pipeline.to(\"cuda\") # Use GPU\n\n# Inference function\ndef generate_image(prompt):\n image = pipeline(prompt).images[0]\n return image\n\n# Gradio interface\ndemo = gr.Interface(\n fn=generate_image,\n inputs=gr.Textbox(label=\"Enter your image prompt\"),\n outputs=gr.Image(type=\"pil\"),\n title=\"DreamShaper v8 - AI Image Generator\",\n description=\"Generate stunning images using the DreamShaper v8 model.\"\n)\n\n# Launch public server\ndemo.launch(share=True)",
"role": "assistant"
}
]
|
README.md exists but content is empty.
- Downloads last month
- 86