Spaces:
Build error
Build error
danseith
commited on
Commit
·
470c4c2
1
Parent(s):
cd3e092
Only new tokens will now be enclosed by asterisks, lowered the upper bound on edits for faster compute.
Browse files
app.py
CHANGED
|
@@ -160,10 +160,13 @@ def unmask(text, temp, rounds):
|
|
| 160 |
while new_token == masked[0]:
|
| 161 |
if unsuccessful_iters > 5:
|
| 162 |
break
|
| 163 |
-
print(new_token)
|
| 164 |
new_token = sample_output(out, sampling='uniform')
|
| 165 |
unsuccessful_iters += 1
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
| 167 |
text = ' '.join(split_text)
|
| 168 |
|
| 169 |
text = list(text)
|
|
@@ -173,8 +176,8 @@ def unmask(text, temp, rounds):
|
|
| 173 |
|
| 174 |
textbox = gr.Textbox(label="Example prompts", lines=5)
|
| 175 |
output_textbox = gr.Textbox(placeholder="Output will appear here", lines=4)
|
| 176 |
-
temp_slider = gr.Slider(1.0,
|
| 177 |
-
edit_slider = gr.Slider(1,
|
| 178 |
|
| 179 |
demo = gr.Interface(
|
| 180 |
fn=unmask,
|
|
|
|
| 160 |
while new_token == masked[0]:
|
| 161 |
if unsuccessful_iters > 5:
|
| 162 |
break
|
| 163 |
+
print('skipped', new_token)
|
| 164 |
new_token = sample_output(out, sampling='uniform')
|
| 165 |
unsuccessful_iters += 1
|
| 166 |
+
if new_token == masked[0]:
|
| 167 |
+
split_text[mask_pos] = new_token
|
| 168 |
+
else:
|
| 169 |
+
split_text[mask_pos] = '*' + new_token + '*'
|
| 170 |
text = ' '.join(split_text)
|
| 171 |
|
| 172 |
text = list(text)
|
|
|
|
| 176 |
|
| 177 |
textbox = gr.Textbox(label="Example prompts", lines=5)
|
| 178 |
output_textbox = gr.Textbox(placeholder="Output will appear here", lines=4)
|
| 179 |
+
temp_slider = gr.Slider(1.0, 3.0, value=1.0, label='Creativity')
|
| 180 |
+
edit_slider = gr.Slider(1, 20, step=5, value=1.0, label='Number of edits')
|
| 181 |
|
| 182 |
demo = gr.Interface(
|
| 183 |
fn=unmask,
|