Skip to content

Commit bba3faa

Browse files
authored
Provide demo code for text (#381)
* Provide demo code how on to create text records. * Remove test code
1 parent 1ebd604 commit bba3faa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

demo/vdl_create_scratch_log

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,20 @@ with logw.mode("train") as logger:
118118

119119
audio.finish_sampling()
120120

121-
121+
# Create text
122+
with logw.mode("train") as logger:
123+
text = logger.text("scratch/generated_text1")
124+
125+
ascii_a = ord('a')
126+
ascii_z = ord('z')
127+
# Generate 100 random text
128+
for i in range(100):
129+
str = ''
130+
for j in range(8):
131+
str += chr(random.randint(ascii_a, ascii_z))
132+
133+
# Add a new text record to the log writer
134+
text.add_record(i, str)
122135

123136
def download_graph_image():
124137
'''

0 commit comments

Comments
 (0)