Update app.py
Browse files
app.py
CHANGED
@@ -226,7 +226,17 @@ def upload_and_manage(file, language):
|
|
226 |
# Mock posting action (you can implement this as needed)
|
227 |
# post_message = mock_post_to_platform(platform, file.name)
|
228 |
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
# def generate_dashboard():
|
232 |
# # Mock analytics generation
|
@@ -261,13 +271,9 @@ def build_interface():
|
|
261 |
|
262 |
# Editable JSON Data
|
263 |
editable_table = gr.Dataframe(
|
264 |
-
value=[
|
265 |
-
{"start": entry["start"], "original": entry["original"], "translated": entry["translated", "end": entry["end"]]}
|
266 |
-
for entry in editable_translations
|
267 |
-
],
|
268 |
headers=["start", "original", "translated", "end"],
|
269 |
datatype=["number", "str", "str", "number"],
|
270 |
-
row_count=
|
271 |
col_count=4,
|
272 |
interactive=[False, True, True, False], # Control editability
|
273 |
label="Edit Translations",
|
@@ -302,7 +308,7 @@ def build_interface():
|
|
302 |
submit_button.click(
|
303 |
upload_and_manage,
|
304 |
inputs=[file_input, language_input],
|
305 |
-
outputs=[editable_translations, processed_video_output]
|
306 |
)
|
307 |
|
308 |
# Connect submit button to save_feedback_db function
|
|
|
226 |
# Mock posting action (you can implement this as needed)
|
227 |
# post_message = mock_post_to_platform(platform, file.name)
|
228 |
|
229 |
+
# Convert the translated JSON into a format for the editable table
|
230 |
+
editable_table = [
|
231 |
+
{
|
232 |
+
"start": entry["start"],
|
233 |
+
"original": entry["original"],
|
234 |
+
"translated": entry["translated"],
|
235 |
+
"end": entry["end"],
|
236 |
+
}
|
237 |
+
for entry in translated_json
|
238 |
+
]
|
239 |
+
return translated_json, editable_table, output_video_path
|
240 |
|
241 |
# def generate_dashboard():
|
242 |
# # Mock analytics generation
|
|
|
271 |
|
272 |
# Editable JSON Data
|
273 |
editable_table = gr.Dataframe(
|
|
|
|
|
|
|
|
|
274 |
headers=["start", "original", "translated", "end"],
|
275 |
datatype=["number", "str", "str", "number"],
|
276 |
+
row_count=0, # Initially empty
|
277 |
col_count=4,
|
278 |
interactive=[False, True, True, False], # Control editability
|
279 |
label="Edit Translations",
|
|
|
308 |
submit_button.click(
|
309 |
upload_and_manage,
|
310 |
inputs=[file_input, language_input],
|
311 |
+
outputs=[editable_translations, editable_table, processed_video_output]
|
312 |
)
|
313 |
|
314 |
# Connect submit button to save_feedback_db function
|