Spaces:
Running on Zero
Running on Zero
Upload app.py
Browse files
app.py
CHANGED
|
@@ -74,10 +74,11 @@ def predict(prompt, dark_mode):
|
|
| 74 |
return "<span style='color: grey'>No tokens generated.</span>", "", gr.update(visible=False), gr.update(visible=False), None, 0
|
| 75 |
|
| 76 |
# Initialize state with all beam data
|
|
|
|
| 77 |
all_beams_data = {
|
| 78 |
"beam_tokens": beam_tokens,
|
| 79 |
"score_vectors": score_vectors,
|
| 80 |
-
"sequences_scores": generated_dicts.sequences_scores
|
| 81 |
}
|
| 82 |
|
| 83 |
# Generate HTML for the first beam (index 0)
|
|
|
|
| 74 |
return "<span style='color: grey'>No tokens generated.</span>", "", gr.update(visible=False), gr.update(visible=False), None, 0
|
| 75 |
|
| 76 |
# Initialize state with all beam data
|
| 77 |
+
# Convert tensors to lists to avoid ZeroGPU serialization errors
|
| 78 |
all_beams_data = {
|
| 79 |
"beam_tokens": beam_tokens,
|
| 80 |
"score_vectors": score_vectors,
|
| 81 |
+
"sequences_scores": generated_dicts.sequences_scores.tolist() if hasattr(generated_dicts.sequences_scores, 'tolist') else generated_dicts.sequences_scores
|
| 82 |
}
|
| 83 |
|
| 84 |
# Generate HTML for the first beam (index 0)
|