Skip to content

Instantly share code, notes, and snippets.

@gynvael
Created March 19, 2023 15:43
Show Gist options
  • Save gynvael/993cd2de1f0f0cba072813c02a5bfde7 to your computer and use it in GitHub Desktop.
Save gynvael/993cd2de1f0f0cba072813c02a5bfde7 to your computer and use it in GitHub Desktop.
GPT-4 output 1 adhoc script
import csv
import html
def sanitize(input_str):
return html.escape(input_str)
html_head = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Conference Proposals</title>
<style>
.entry {
border: 1px solid #ccc;
margin-bottom: 20px;
padding: 20px;
}
h2 { margin-top: 0; }
</style>
</head>
<body>
'''
print(html_head)
with open('cfp.csv', 'r', encoding='utf-8') as csvfile:
reader = csv.reader(csvfile)
next(reader) # Skip header row
for row in reader:
sanitized_row = [sanitize(cell) for cell in row]
first_name, last_name, company, bio, topic, category, level, abstract, language, additional_info = sanitized_row[1], sanitized_row[2], sanitized_row[6], sanitized_row[7], sanitized_row[8], sanitized_row[9], sanitized_row[10], sanitized_row[11], sanitized_row[12], sanitized_row[13]
if not (topic and abstract):
continue
entry = f'''
<div class="entry">
<h2>{topic}</h2>
<p><strong>Speaker:</strong> {first_name} {last_name} ({company})</p>
<p><strong>Category:</strong> {category}</p>
<p><strong>Audience Level:</strong> {level}</p>
<p><strong>Abstract:</strong> {abstract}</p>
<p><strong>Language:</strong> {language}</p>
<p><strong>Additional Info:</strong> {additional_info}</p>
</div>
'''
print(entry)
html_tail = '''
</body>
</html>
'''
print(html_tail)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment