jbpb123 commited on
Commit
ba54f7a
·
verified ·
1 Parent(s): 1fd185c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -2,7 +2,7 @@ import sys
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,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"].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,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 = 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}")
 
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}")