Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,16 @@ def translate_text(input_texts):
|
|
34 |
ort_outputs = session.run(None, ort_inputs)
|
35 |
output_ids = ort_outputs[0] # Get the output token IDs
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
# Decode the output tokens
|
38 |
translated_texts = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
|
39 |
return translated_texts
|
|
|
34 |
ort_outputs = session.run(None, ort_inputs)
|
35 |
output_ids = ort_outputs[0] # Get the output token IDs
|
36 |
|
37 |
+
# Debug: Inspect the structure of output_ids
|
38 |
+
print("Output IDs shape:", output_ids.shape)
|
39 |
+
print("Output IDs:", output_ids)
|
40 |
+
|
41 |
+
# Ensure output_ids is in the correct format (2D array)
|
42 |
+
if isinstance(output_ids, list):
|
43 |
+
output_ids = np.array(output_ids) # Convert list to numpy array if necessary
|
44 |
+
if output_ids.ndim > 2:
|
45 |
+
output_ids = output_ids.squeeze(0) # Remove extra dimensions if present
|
46 |
+
|
47 |
# Decode the output tokens
|
48 |
translated_texts = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
|
49 |
return translated_texts
|