Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import sys
|
|
| 2 |
import json
|
| 3 |
from datetime import datetime
|
| 4 |
import gradio as gr
|
| 5 |
-
from
|
| 6 |
|
| 7 |
|
| 8 |
def _get_scene_titles(storydata):
|
|
@@ -27,20 +27,18 @@ def _print_text_component(comp, output_lines):
|
|
| 27 |
def _print_dialog_component(comp, config, output_lines):
|
| 28 |
character_key = comp.get("characterAssetId")
|
| 29 |
character_name = config.get("characterMap", {}).get(character_key, {}).get("characterName")
|
| 30 |
-
dialog = comp["dialog"]
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
print()
|
| 38 |
-
output_lines.append(
|
| 39 |
-
|
| 40 |
-
print(dialog)
|
| 41 |
-
output_lines.append(dialog)
|
| 42 |
-
output_lines.append("")
|
| 43 |
print()
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
def _print_jump_component(comp, scene_titles, output_lines):
|
|
@@ -192,16 +190,16 @@ def format_story(storydata):
|
|
| 192 |
# Dates of creation and last modification
|
| 193 |
created = storydata.get("createdOn")
|
| 194 |
if created is not None:
|
| 195 |
-
created =
|
|
|
|
| 196 |
#_write_to_file(file, f"{created}")
|
| 197 |
#_write_to_file(file, "")
|
| 198 |
-
output_lines.append(created)
|
| 199 |
lastmod = storydata.get("lastModified")
|
| 200 |
if lastmod is not None:
|
| 201 |
-
lastmod =
|
|
|
|
| 202 |
#_write_to_file(file, f"{lastmod}")
|
| 203 |
#_write_to_file(file, "")
|
| 204 |
-
output_lines.append(lastmod)
|
| 205 |
print(f"Created {created}")
|
| 206 |
print()
|
| 207 |
print(f"Last modified {lastmod}")
|
|
|
|
| 2 |
import json
|
| 3 |
from datetime import datetime
|
| 4 |
import gradio as gr
|
| 5 |
+
from dateutil import parser
|
| 6 |
|
| 7 |
|
| 8 |
def _get_scene_titles(storydata):
|
|
|
|
| 27 |
def _print_dialog_component(comp, config, output_lines):
|
| 28 |
character_key = comp.get("characterAssetId")
|
| 29 |
character_name = config.get("characterMap", {}).get(character_key, {}).get("characterName")
|
| 30 |
+
dialog = comp["dialog"].replace("\n", " ")
|
| 31 |
+
|
| 32 |
+
if character_name:
|
| 33 |
+
dialog_line = f"{character_name}: {dialog}"
|
| 34 |
+
print(dialog_line)
|
| 35 |
+
output_lines.append(dialog_line)
|
| 36 |
+
else:
|
| 37 |
+
print(dialog)
|
| 38 |
+
output_lines.append(dialog)
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
| 40 |
print()
|
| 41 |
+
output_lines.append("")
|
| 42 |
|
| 43 |
|
| 44 |
def _print_jump_component(comp, scene_titles, output_lines):
|
|
|
|
| 190 |
# Dates of creation and last modification
|
| 191 |
created = storydata.get("createdOn")
|
| 192 |
if created is not None:
|
| 193 |
+
created = parser.isoparse(created).strftime("%Y/%m/%d")
|
| 194 |
+
output_lines.append(created)
|
| 195 |
#_write_to_file(file, f"{created}")
|
| 196 |
#_write_to_file(file, "")
|
|
|
|
| 197 |
lastmod = storydata.get("lastModified")
|
| 198 |
if lastmod is not None:
|
| 199 |
+
lastmod = parser.isoparse(lastmod).strftime("%Y/%m/%d")
|
| 200 |
+
output_lines.append(lastmod)
|
| 201 |
#_write_to_file(file, f"{lastmod}")
|
| 202 |
#_write_to_file(file, "")
|
|
|
|
| 203 |
print(f"Created {created}")
|
| 204 |
print()
|
| 205 |
print(f"Last modified {lastmod}")
|