Skip to content

Instantly share code, notes, and snippets.

View garystafford's full-sized avatar
💭
Happily Coding!

Gary A. Stafford garystafford

💭
Happily Coding!
View GitHub Profile
from diffusers import DiffusionPipeline, StableDiffusionXLImg2ImgPipeline
device = "cuda" # cpu or cuda
pipeline = DiffusionPipeline.from_pretrained(
model_name_base,
torch_dtype=torch.float16,
).to(device)
refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
# optional descriptive terms: sleek, futuristic, metallic, colorful, urban
subject_prompt = """oue, marker rendering of oue electric scooter, concept art,
futuristic cityscape, solid color background, bright vibrant colors, marker, sketch,
illustration, illustrative, marker drawing, expressive strokes, graphic"""
subject_negative_prompt = """person, people, human, rider, floating objects, text,
words, writing, letters, phrases, trademark, watermark, icon, logo, banner, signature,
username, monochrome, cropped, cut-off, patterned background"""
refiner_prompt = """sharp, crisp, in-focus, uncropped, high-quality"""
chpt paras words chrs tokens ratio cost
--------------------------------------------------------
1 39 5,547 30,624 7,218 4.24 0.080
2 62 5,305 28,510 6,833 4.17 0.075
3 46 5,571 29,805 7,075 4.21 0.078
4 86 5,703 30,267 7,338 4.12 0.081
5 28 3,390 18,019 4,650 3.88 0.051
6 64 5,299 29,195 7,524 3.88 0.083
7 62 5,424 29,964 7,120 4.21 0.078
8 59 6,044 32,637 7,970 4.09 0.088
Chapter Characters Words Tokens Chars/Token
1 30624 5547 7227 4.24
2 28510 5305 6842 4.17
3 29805 5571 7084 4.21
4 30267 5703 7347 4.12
5 18019 3390 4659 3.87
6 29195 5299 7533 3.88
7 29964 5424 7130 4.20
8 32637 6044 7979 4.09
9 30180 5709 7486 4.03
# Purpose: Generate demographic data
# Author: Gary A. Stafford and GitHub Copilot
# Date: 2023-04-14
# Usage: python3 demographic_data_gen.py 100
# Command-line argument(s): rec_count (number of records to generate as an integer)
# Write an application that creates a file containing demographic data.
# The application should accept a command line argument that specifies the number of records to generate.
# The application should write the demographic data to a file called 'demographic_data.csv'.
# The application should contain the following functions:
# Purpose: Generate US residential address data
# Author: Gary A. Stafford and GitHub Copilot
# Date: 2023-04-13
# Usage: python3 residential_address_data_gen.py 100
# Command-line argument(s): rec_count (number of records to generate as an integer)
# Write an application that create a random list of united states addresses.
# The application should accept a command line argument that specifies the number of records to generate.
# Include address, city, state, zip code, country, and property type.
# Write the data to a csv file named 'address_data.csv'.
# Purpose: Generate coffee shop sales data
# Author: Gary A. Stafford and GitHub Copilot
# Date: 2023-04-12
# Usage: python3 coffee_shop_data_gen.py 100
# Command-line argument(s): rec_count (number of records to generate as an integer)
# Write a program that creates synthetic sales data for a coffee shop.
# The program should accept a command line argument that specifies the number of records to generate.
# The program should write the sales data to a file called 'coffee_shop_sales_data.csv'.
# The program should contain the following functions:
user_id first_name last_name dob gender martital_status race religion
1 Thomas Powell 1967-06-10 Male Married Black Christian
2 Ward Williams 1973-07-22 Male Single Asian Christian
3 Martha Watson 1975-02-28 Feamle Single Hispanic Agnostic
4 Brenda Bailey 1979-07-07 Feamle Married Black Christian
5 Parker Johnson 1955-07-14 Male Married White Christian
6 Rebecca Wilson 1972-05-27 Feamle Married White Christian
7 Doris Allen 1956-07-09 Feamle Married Multiracial Christian
8 Rebecca Sanchez 1965-09-16 Feamle Single White Christian
9 Mary Johnson 1971-04-04 Feamle Single White Christian
id address city state zip country property_type assessed_value
1 1008 Walk Burg Houston TX 77002 United States Multi-family 1122321
2 7088 Second Square Oklahoma City OK 73102 United States Single-family 261940
3 1425 Ridge Terrace Indianapolis IN 46204 United States Single-family 1030391
4 982 Way Lane New York NY 10007 United States Multi-family 95499
5 9404 Port Court Columbus OH 43215 United States Single-family 922404
6 7135 Crossing Trail Virginia Beach VA 23451 United States Single-family 272910
7 9481 Harbor Brook New York NY 10007 United States Multi-family 232795
8 8585 Manor Branch Raleigh NC 27601 United States Single-family 701217
9 7703 Bluff Boulevard Las Vegas NV 89101 United States Single-family 530581
# Purpose: Test coffee shop sales data generator
# Author: Gary A. Stafford and GitHub Copilot
# Date: 2023-04-13
# Usage: pytest coffee_shop_data_gen_tests.py -v
# write a python class that inherits from unittest.TestCase
# write a unit test for the get_product function
# write a unit test for the get_sales_record function
# write a unit test for the write_sales_records function