Spaces:
Sleeping
Sleeping
Commit
·
b4dc755
1
Parent(s):
f727cfc
fix progress bar
Browse files
app.py
CHANGED
@@ -128,7 +128,8 @@ def generate_with_feedback(sent1, approx, progress=gr.Progress()):
|
|
128 |
'attention_mask': torch.ones_like(input_ids)
|
129 |
}
|
130 |
|
131 |
-
progress
|
|
|
132 |
pred, (pred_text, interpolations) = model.infer_with_feedback_BP(ling_disc, sem_emb, inputs, tokenizer, progress)
|
133 |
|
134 |
interpolation = '-- ' + '\n-- '.join(interpolations)
|
@@ -148,7 +149,7 @@ def generate_random(sent1, count, approx, progress=gr.Progress()):
|
|
148 |
success = False
|
149 |
patience = 0
|
150 |
while not success:
|
151 |
-
pred, interpolation = generate_with_feedback(sent1, approx)[:2]
|
152 |
if pred not in preds:
|
153 |
success = True
|
154 |
elif patience < 10:
|
|
|
128 |
'attention_mask': torch.ones_like(input_ids)
|
129 |
}
|
130 |
|
131 |
+
if progress is not None:
|
132 |
+
progress((0, None), unit='intermediate paraphrase generated.')
|
133 |
pred, (pred_text, interpolations) = model.infer_with_feedback_BP(ling_disc, sem_emb, inputs, tokenizer, progress)
|
134 |
|
135 |
interpolation = '-- ' + '\n-- '.join(interpolations)
|
|
|
149 |
success = False
|
150 |
patience = 0
|
151 |
while not success:
|
152 |
+
pred, interpolation = generate_with_feedback(sent1, approx, progress=None)[:2]
|
153 |
if pred not in preds:
|
154 |
success = True
|
155 |
elif patience < 10:
|