saq1b commited on
Commit
c1a4c87
·
verified ·
1 Parent(s): bfd3098

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -218
app.py CHANGED
@@ -34,183 +34,8 @@ class PodcastGenerator:
34
  {
35
  "speaker": 1,
36
  "line": "Yeah, it's definitely having a moment, isn't it?"
37
- },
38
- {
39
- "speaker": 2,
40
- "line": "It is and for good reason, right? I mean, you've been digging into this stuff, listening to the podcasts and everything. What really stood out to you? What got you hooked?"
41
- },
42
- {
43
- "speaker": 1,
44
- "line": "Honestly, it's the sheer scale of what AGI could do. We're talking about potentially reshaping well everything."
45
- },
46
- {
47
- "speaker": 2,
48
- "line": "No kidding, but let's be real. Sometimes it feels like every other headline is either hyping AGI up as this technological utopia or painting it as our inevitable robot overlords."
49
- },
50
- {
51
- "speaker": 1,
52
- "line": "It's easy to get lost in the noise, for sure."
53
- },
54
- {
55
- "speaker": 2,
56
- "line": "Exactly. So how about we try to cut through some of that, shall we?"
57
- },
58
- {
59
- "speaker": 1,
60
- "line": "Sounds like a plan."
61
- },
62
- {
63
- "speaker": 2,
64
- "line": "Okay, so first things first, AGI, what is it really? And I don't just mean some dictionary definition, we're talking about something way bigger than just a super smart computer, right?"
65
- },
66
- {
67
- "speaker": 1,
68
- "line": "Right, it's not just about more processing power or better algorithms, it's about a fundamental shift in how we think about intelligence itself."
69
- },
70
- {
71
- "speaker": 2,
72
- "line": "So like, instead of programming a machine for a specific task, we're talking about creating something that can learn and adapt like we do."
73
- },
74
- {
75
- "speaker": 1,
76
- "line": "Exactly, think of it this way: Right now, we've got AI that can beat a grandmaster at chess but ask that same AI to, say, write a poem or compose a symphony. No chance."
77
- },
78
- {
79
- "speaker": 2,
80
- "line": "Okay, I see. So, AGI is about bridging that gap, creating something that can move between those different realms of knowledge seamlessly."
81
- },
82
- {
83
- "speaker": 1,
84
- "line": "Precisely. It's about replicating that uniquely human ability to learn something new and apply that knowledge in completely different contexts and that's a tall order, let me tell you."
85
- },
86
- {
87
- "speaker": 2,
88
- "line": "I bet. I mean, think about how much we still don't even understand about our own brains."
89
- },
90
- {
91
- "speaker": 1,
92
- "line": "That's exactly it. We're essentially trying to reverse-engineer something we don't fully comprehend."
93
- },
94
- {
95
- "speaker": 2,
96
- "line": "And how are researchers even approaching that? What are some of the big ideas out there?"
97
- },
98
- {
99
- "speaker": 1,
100
- "line": "Well, there are a few different schools of thought. One is this idea of neuromorphic computing where they're literally trying to build computer chips that mimic the structure and function of the human brain."
101
- },
102
- {
103
- "speaker": 2,
104
- "line": "Wow, so like actually replicating the physical architecture of the brain. That's wild."
105
- },
106
- {
107
- "speaker": 1,
108
- "line": "It's pretty mind-blowing stuff and then you've got folks working on something called whole brain emulation."
109
- },
110
- {
111
- "speaker": 2,
112
- "line": "Okay, and what's that all about?"
113
- },
114
- {
115
- "speaker": 1,
116
- "line": "The basic idea there is to create a complete digital copy of a human brain down to the last neuron and synapse and run it on a sufficiently powerful computer simulation."
117
- },
118
- {
119
- "speaker": 2,
120
- "line": "Hold on, a digital copy of an entire brain, that sounds like something straight out of science fiction."
121
- },
122
- {
123
- "speaker": 1,
124
- "line": "It does, doesn't it? But it gives you an idea of the kind of ambition we're talking about here and the truth is we're still a long way off from truly achieving AGI, no matter which approach you look at."
125
- },
126
- {
127
- "speaker": 2,
128
- "line": "That makes sense but it's still exciting to think about the possibilities, even if they're a ways off."
129
- },
130
- {
131
- "speaker": 1,
132
- "line": "Absolutely and those possibilities are what really get people fired up about AGI, right? Yeah."
133
- },
134
- {
135
- "speaker": 2,
136
- "line": "For sure. In fact, I remember you mentioning something in that podcast about AGI's potential to revolutionize scientific research. Something about supercharging breakthroughs."
137
- },
138
- {
139
- "speaker": 1,
140
- "line": "Oh, absolutely. Imagine an AI that doesn't just crunch numbers but actually understands scientific data the way a human researcher does. We're talking about potential breakthroughs in everything from medicine and healthcare to material science and climate change."
141
- },
142
- {
143
- "speaker": 2,
144
- "line": "It's like giving scientists this incredibly powerful new tool to tackle some of the biggest challenges we face."
145
- },
146
- {
147
- "speaker": 1,
148
- "line": "Exactly, it could be a total game changer."
149
- },
150
- {
151
- "speaker": 2,
152
- "line": "Okay, but let's be real, every coin has two sides. What about the potential downsides of AGI? Because it can't all be sunshine and roses, right?"
153
- },
154
- {
155
- "speaker": 1,
156
- "line": "Right, there are definitely valid concerns. Probably the biggest one is the impact on the job market. As AGI gets more sophisticated, there's a real chance it could automate a lot of jobs that are currently done by humans."
157
- },
158
- {
159
- "speaker": 2,
160
- "line": "So we're not just talking about robots taking over factories but potentially things like, what, legal work, analysis, even creative fields?"
161
- },
162
- {
163
- "speaker": 1,
164
- "line": "Potentially, yes. And that raises a whole host of questions about what happens to those workers, how we retrain them, how we ensure that the benefits of AGI are shared equitably."
165
- },
166
- {
167
- "speaker": 2,
168
- "line": "Right, because it's not just about the technology itself, but how we choose to integrate it into society."
169
- },
170
- {
171
- "speaker": 1,
172
- "line": "Absolutely. We need to be having these conversations now about ethics, about regulation, about how to make sure AGI is developed and deployed responsibly."
173
- },
174
- {
175
- "speaker": 2,
176
- "line": "So it's less about preventing some kind of sci-fi robot apocalypse and more about making sure we're steering this technology in the right direction from the get-go."
177
- },
178
- {
179
- "speaker": 1,
180
- "line": "Exactly, AGI has the potential to be incredibly beneficial, but it's not going to magically solve all our problems. It's on us to make sure we're using it for good."
181
- },
182
- {
183
- "speaker": 2,
184
- "line": "It's like you said earlier, it's about shaping the future of intelligence."
185
- },
186
- {
187
- "speaker": 1,
188
- "line": "I like that. It really is."
189
- },
190
- {
191
- "speaker": 2,
192
- "line": "And honestly, that's a responsibility that extends beyond just the researchers and the policymakers."
193
- },
194
- {
195
- "speaker": 1,
196
- "line": "100%"
197
- },
198
- {
199
- "speaker": 2,
200
- "line": "So to everyone listening out there I'll leave you with this. As AGI continues to develop, what role do you want to play in shaping its future?"
201
- },
202
- {
203
- "speaker": 1,
204
- "line": "That's a question worth pondering."
205
- },
206
- {
207
- "speaker": 2,
208
- "line": "It certainly is and on that note, we'll wrap up this deep dive. Thanks for listening, everyone."
209
- },
210
- {
211
- "speaker": 1,
212
- "line": "Peace."
213
  }
 
214
  ]
215
  }
216
  """
@@ -394,55 +219,64 @@ async def process_input(input_text: str, input_file, language: str, speaker1: st
394
  logging.error("Process input error: %s", e)
395
  raise gr.Error(f"Error in processing input: {e}")
396
 
397
- # Create the Gradio Interface
398
  iface = gr.Interface(
399
  fn=process_input,
400
  inputs=[
401
  gr.Textbox(label="Input Text"),
402
  gr.File(label="Or Upload a PDF or TXT file"),
403
- gr.Dropdown(label="Language", choices=[
404
- "Auto Detect",
405
- "Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Azerbaijani",
406
- "Bahasa Indonesian", "Bangla", "Basque", "Bengali", "Bosnian", "Bulgarian",
407
- "Burmese", "Catalan", "Chinese Cantonese", "Chinese Mandarin",
408
- "Chinese Taiwanese", "Croatian", "Czech", "Danish", "Dutch", "English",
409
- "Estonian", "Filipino", "Finnish", "French", "Galician", "Georgian",
410
- "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Irish",
411
- "Italian", "Japanese", "Javanese", "Kannada", "Kazakh", "Khmer", "Korean",
412
- "Lao", "Latvian", "Lithuanian", "Macedonian", "Malay", "Malayalam",
413
- "Maltese", "Mongolian", "Nepali", "Norwegian Bokmål", "Pashto", "Persian",
414
- "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Sinhala",
415
- "Slovak", "Slovene", "Somali", "Spanish", "Sundanese", "Swahili",
416
- "Swedish", "Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu",
417
- "Uzbek", "Vietnamese", "Welsh", "Zulu"
418
- ],
419
- value="Auto Detect"),
420
- gr.Dropdown(label="Speaker 1 Voice", choices=[
421
- "Andrew - English (United States)",
422
- "Ava - English (United States)",
423
- "Brian - English (United States)",
424
- "Emma - English (United States)",
425
- "Florian - German (Germany)",
426
- "Seraphina - German (Germany)",
427
- "Remy - French (France)",
428
- "Vivienne - French (France)"
429
- ],
430
- value="Andrew - English (United States)"),
431
- gr.Dropdown(label="Speaker 2 Voice", choices=[
432
- "Andrew - English (United States)",
433
- "Ava - English (United States)",
434
- "Brian - English (United States)",
435
- "Emma - English (United States)",
436
- "Florian - German (Germany)",
437
- "Seraphina - German (Germany)",
438
- "Remy - French (France)",
439
- "Vivienne - French (France)"
440
- ],
441
- value="Ava - English (United States)"),
 
 
 
 
 
 
 
 
 
442
  gr.Textbox(label="Your Gemini API Key (Optional) - In case you are getting rate limited"),
443
  ],
444
  outputs=[
445
- gr.Audio(label="Generated Podcast Audio")
446
  ],
447
  title="PodcastGen 🎙️",
448
  description="Generate a 2-speaker podcast from text input or documents!",
@@ -450,4 +284,4 @@ iface = gr.Interface(
450
  )
451
 
452
  if __name__ == "__main__":
453
- iface.launch()
 
34
  {
35
  "speaker": 1,
36
  "line": "Yeah, it's definitely having a moment, isn't it?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
+ // ... (rest of the example)
39
  ]
40
  }
41
  """
 
219
  logging.error("Process input error: %s", e)
220
  raise gr.Error(f"Error in processing input: {e}")
221
 
222
+ # Note the updated output: forcing type="filepath" to avoid the schema bug.
223
  iface = gr.Interface(
224
  fn=process_input,
225
  inputs=[
226
  gr.Textbox(label="Input Text"),
227
  gr.File(label="Or Upload a PDF or TXT file"),
228
+ gr.Dropdown(
229
+ label="Language",
230
+ choices=[
231
+ "Auto Detect",
232
+ "Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Azerbaijani",
233
+ "Bahasa Indonesian", "Bangla", "Basque", "Bengali", "Bosnian", "Bulgarian",
234
+ "Burmese", "Catalan", "Chinese Cantonese", "Chinese Mandarin",
235
+ "Chinese Taiwanese", "Croatian", "Czech", "Danish", "Dutch", "English",
236
+ "Estonian", "Filipino", "Finnish", "French", "Galician", "Georgian",
237
+ "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Irish",
238
+ "Italian", "Japanese", "Javanese", "Kannada", "Kazakh", "Khmer", "Korean",
239
+ "Lao", "Latvian", "Lithuanian", "Macedonian", "Malay", "Malayalam",
240
+ "Maltese", "Mongolian", "Nepali", "Norwegian Bokmål", "Pashto", "Persian",
241
+ "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Sinhala",
242
+ "Slovak", "Slovene", "Somali", "Spanish", "Sundanese", "Swahili",
243
+ "Swedish", "Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu",
244
+ "Uzbek", "Vietnamese", "Welsh", "Zulu"
245
+ ],
246
+ value="Auto Detect"
247
+ ),
248
+ gr.Dropdown(
249
+ label="Speaker 1 Voice",
250
+ choices=[
251
+ "Andrew - English (United States)",
252
+ "Ava - English (United States)",
253
+ "Brian - English (United States)",
254
+ "Emma - English (United States)",
255
+ "Florian - German (Germany)",
256
+ "Seraphina - German (Germany)",
257
+ "Remy - French (France)",
258
+ "Vivienne - French (France)"
259
+ ],
260
+ value="Andrew - English (United States)"
261
+ ),
262
+ gr.Dropdown(
263
+ label="Speaker 2 Voice",
264
+ choices=[
265
+ "Andrew - English (United States)",
266
+ "Ava - English (United States)",
267
+ "Brian - English (United States)",
268
+ "Emma - English (United States)",
269
+ "Florian - German (Germany)",
270
+ "Seraphina - German (Germany)",
271
+ "Remy - French (France)",
272
+ "Vivienne - French (France)"
273
+ ],
274
+ value="Ava - English (United States)"
275
+ ),
276
  gr.Textbox(label="Your Gemini API Key (Optional) - In case you are getting rate limited"),
277
  ],
278
  outputs=[
279
+ gr.Audio(label="Generated Podcast Audio", type="filepath")
280
  ],
281
  title="PodcastGen 🎙️",
282
  description="Generate a 2-speaker podcast from text input or documents!",
 
284
  )
285
 
286
  if __name__ == "__main__":
287
+ iface.launch()