nairut commited on
Commit
c4c3320
·
verified ·
1 Parent(s): c7a28ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -98,13 +98,20 @@ class TranslationPair(BaseModel):
98
  # ==========================================================
99
  # 🔧 Função utilitária
100
  # ==========================================================
 
101
  def prepare_data(pairs: list[TranslationPair]):
102
  """
103
- Converte lista de TranslationPair no formato esperado pelo COMETKiwi-DA-XL:
104
- [{"src": ..., "mt": ...}, ...]
105
  """
106
- return [{"src": p.source.strip(), "mt": p.target.strip()} for p in pairs if p.source.strip() and p.target.strip()]
107
-
 
 
 
 
 
 
108
 
109
  # ==========================================================
110
  # 🌐 Endpoints
 
98
  # ==========================================================
99
  # 🔧 Função utilitária
100
  # ==========================================================
101
+
102
  def prepare_data(pairs: list[TranslationPair]):
103
  """
104
+ Converte lista de TranslationPair no formato esperado pelo COMET:
105
+ [{"src": ..., "mt": ..., "ref": ...}, ...]
106
  """
107
+ data = []
108
+ for p in pairs:
109
+ src = str(p.source).strip()
110
+ mt = str(p.target).strip()
111
+ item = {"src": src, "mt": mt}
112
+
113
+ data.append(item)
114
+ return data
115
 
116
  # ==========================================================
117
  # 🌐 Endpoints