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,18 +27,20 @@ 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()
|
|
|
|
| 41 |
output_lines.append("")
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
def _print_jump_component(comp, scene_titles, output_lines):
|
|
@@ -190,16 +192,16 @@ def format_story(storydata):
|
|
| 190 |
# Dates of creation and last modification
|
| 191 |
created = storydata.get("createdOn")
|
| 192 |
if created is not None:
|
| 193 |
-
created =
|
| 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 =
|
| 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}")
|
|
|
|
| 2 |
import json
|
| 3 |
from datetime import datetime
|
| 4 |
import gradio as gr
|
| 5 |
+
from gradio import inputs
|
| 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"]
|
| 31 |
+
|
| 32 |
+
# Format the dialog nice
|
| 33 |
+
dialog = "> " + dialog.replace("\n", "\n> ")
|
| 34 |
+
|
| 35 |
+
if character_name is not None:
|
| 36 |
+
print(f"{character_name}:")
|
| 37 |
+
print()
|
| 38 |
+
output_lines.append(f"{character_name}:")
|
| 39 |
+
output_lines.append("")
|
| 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 |
# Dates of creation and last modification
|
| 193 |
created = storydata.get("createdOn")
|
| 194 |
if created is not None:
|
| 195 |
+
created = datetime.fromisoformat(created).strftime("%Y/%m/%d")
|
|
|
|
| 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 = datetime.fromisoformat(lastmod).strftime("%Y/%m/%d")
|
|
|
|
| 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}")
|