Spaces:
Running
on
T4
Running
on
T4
gabrielchua
commited on
Commit
•
da7d0fa
1
Parent(s):
cecf748
update gradio UI
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ class Dialogue(BaseModel):
|
|
32 |
"""The dialogue between the host and guest."""
|
33 |
|
34 |
scratchpad: str
|
35 |
-
|
36 |
dialogue: List[DialogueItem]
|
37 |
|
38 |
|
@@ -49,13 +49,16 @@ def generate_podcast(file: str) -> Tuple[str, str]:
|
|
49 |
|
50 |
# Process the dialogue
|
51 |
audio_segments = []
|
52 |
-
transcript = ""
|
53 |
total_characters = 0
|
54 |
|
55 |
for line in llm_output.dialogue:
|
56 |
logger.info(f"Generating audio for {line.speaker}: {line.text}")
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
59 |
total_characters += len(line.text)
|
60 |
|
61 |
# Get audio file path
|
@@ -99,10 +102,11 @@ demo = gr.Interface(
|
|
99 |
],
|
100 |
outputs=[
|
101 |
gr.Audio(label="Audio", format="mp3"),
|
102 |
-
gr.
|
103 |
],
|
104 |
allow_flagging="never",
|
105 |
api_name=False,
|
|
|
106 |
)
|
107 |
|
108 |
if __name__ == "__main__":
|
|
|
32 |
"""The dialogue between the host and guest."""
|
33 |
|
34 |
scratchpad: str
|
35 |
+
name_of_guest: str
|
36 |
dialogue: List[DialogueItem]
|
37 |
|
38 |
|
|
|
49 |
|
50 |
# Process the dialogue
|
51 |
audio_segments = []
|
52 |
+
transcript = "" # start with an empty transcript
|
53 |
total_characters = 0
|
54 |
|
55 |
for line in llm_output.dialogue:
|
56 |
logger.info(f"Generating audio for {line.speaker}: {line.text}")
|
57 |
+
if line.speaker == "Host (Jane)":
|
58 |
+
speaker = f"**Jane**: {line.text}"
|
59 |
+
else:
|
60 |
+
speaker = f"**{llm_output.name_of_guest}**: {line.text}"
|
61 |
+
transcript += speaker + "\n\n"
|
62 |
total_characters += len(line.text)
|
63 |
|
64 |
# Get audio file path
|
|
|
102 |
],
|
103 |
outputs=[
|
104 |
gr.Audio(label="Audio", format="mp3"),
|
105 |
+
gr.Markdown(label="Transcript"),
|
106 |
],
|
107 |
allow_flagging="never",
|
108 |
api_name=False,
|
109 |
+
theme=gr.themes.Soft()
|
110 |
)
|
111 |
|
112 |
if __name__ == "__main__":
|