Imane Momayiz
commited on
Commit
·
cac7ab2
1
Parent(s):
9bfca27
fix: submissions
Browse files
app.py
CHANGED
@@ -30,10 +30,14 @@ def fetch_sentence(dataset, column_name="darija_ar"):
|
|
30 |
|
31 |
return random_sentence
|
32 |
|
33 |
-
def store_submission(api: HfApi
|
|
|
|
|
|
|
|
|
34 |
|
35 |
if st.button("Submit Translation"):
|
36 |
-
if not
|
37 |
st.warning("Please enter a translation before submitting.")
|
38 |
else:
|
39 |
ts = dt.datetime.now().strftime("%Y-%m-%d_%H-%M-%S-%f")
|
@@ -124,10 +128,4 @@ with translation_input_placeholder_fr.container():
|
|
124 |
)
|
125 |
st.session_state.translation_input_fr = translation_input_fr
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
store_submission(api,
|
130 |
-
st.session_state.sentence,
|
131 |
-
st.session_state.translation_input,
|
132 |
-
st.session_state.translation_input_fr
|
133 |
-
)
|
|
|
30 |
|
31 |
return random_sentence
|
32 |
|
33 |
+
def store_submission(api: HfApi):
|
34 |
+
|
35 |
+
sentence = st.session_state.sentence,
|
36 |
+
translation = st.session_state.translation_input,
|
37 |
+
translation_fr = st.session_state.translation_input_fr
|
38 |
|
39 |
if st.button("Submit Translation"):
|
40 |
+
if not translation and translation_fr:
|
41 |
st.warning("Please enter a translation before submitting.")
|
42 |
else:
|
43 |
ts = dt.datetime.now().strftime("%Y-%m-%d_%H-%M-%S-%f")
|
|
|
128 |
)
|
129 |
st.session_state.translation_input_fr = translation_input_fr
|
130 |
|
131 |
+
store_submission(api)
|
|
|
|
|
|
|
|
|
|
|
|