tonic commited on
Commit
3f36ef5
1 Parent(s): 3b901a6
Files changed (2) hide show
  1. .env +1 -1
  2. app.py +7 -78
.env CHANGED
@@ -1,2 +1,2 @@
1
  CO_API_KEY=KQBPf0H0ENZESIC5nuUJ4i4jjg34xMPAkYK7s31W
2
- SEAMLESSM4T=https://facebook-seamless-m4t-v2-large.hf.space/--replicas/v4gsf/
 
1
  CO_API_KEY=KQBPf0H0ENZESIC5nuUJ4i4jjg34xMPAkYK7s31W
2
+ SEAMLESSM4T=facebook/seamless-m4t-v2-large
app.py CHANGED
@@ -278,6 +278,7 @@ inputs = [
278
 
279
  outputs = [
280
  RichTextbox(label="Processed Text"),
 
281
  gr.Textbox(label="Focus 1"),
282
  gr.Textbox(label="Translated Phrases 1"),
283
  gr.Audio(label="Audio Output (Native Language) 1"),
@@ -292,9 +293,9 @@ outputs = [
292
  gr.Audio(label="Audio Output (Target Language) 3")
293
  ]
294
  def update_outputs(inputlanguage, target_language, audio, image, text, file):
295
- final_text, top_phrases, translations, audio_outputs = process_input(
296
- image=image, file=file, audio=audio, text=text,
297
- translateto=target_language, translatefrom=inputlanguage
298
  )
299
  processed_text_output = final_text
300
  audio_output_native_phrases = [native for _, native in audio_outputs]
@@ -306,7 +307,8 @@ def update_outputs(inputlanguage, target_language, audio, image, text, file):
306
  audio_outputs_target = audio_output_target_phrases[:3]
307
 
308
  return (
309
- processed_text_output,
 
310
  *audio_outputs_native,
311
  *audio_outputs_target,
312
  *longest_phrases_outputs,
@@ -320,77 +322,4 @@ def interface_func(inputlanguage, target_language, audio, image, text, file):
320
  iface = gr.Interface(fn=interface_func, inputs=inputs, outputs=outputs, title=title, description=description)
321
 
322
  if __name__ == "__main__":
323
- iface.launch()
324
-
325
- # def main():
326
- # with gr.Blocks() as demo:
327
- # gr.Markdown(title)
328
- # gr.Markdown(description)
329
-
330
- # with gr.Row():
331
- # input_language = gr.Dropdown(choices=choices, label="Your Native Language")
332
- # target_language = gr.Dropdown(choices=choices, label="Language To Learn")
333
-
334
- # with gr.Accordion("Talk To 🌟AyaTonic"):
335
- # with gr.Tab("🤙🏻Audio & Text"):
336
- # audio_input = gr.Audio(sources="microphone", type="filepath", label="Mic Input")
337
- # text_input = gr.Textbox(lines=2, label="Text Input")
338
- # with gr.Tab("📸Image & File"):
339
- # image_input = gr.Image(type="pil", label="Camera Input")
340
- # file_input = gr.File(label="File Upload")
341
-
342
- # process_button = gr.Button("🌟AyaTonic")
343
-
344
- # processed_text_output = RichTextbox(label="Processed Text")
345
- # longest_phrases_1 = gr.Textbox(label="Focus")
346
- # translated_phrases_output_1 = gr.Textbox(label="Translated Phrases")
347
- # audio_output_native_phrase_1 = gr.Audio(label="Audio Output (Native Language)")
348
- # audio_output_target_phrase_1 = gr.Audio(label="Audio Output (Target Language)")
349
- # longest_phrases_2 = gr.Textbox(label="Focus")
350
- # translated_phrases_output_2 = gr.Textbox(label="Translated Phrases")
351
- # audio_output_native_phrase_2 = gr.Audio(label="Audio Output (Native Language)")
352
- # audio_output_target_phrase_2 = gr.Audio(label="Audio Output (Target Language)")
353
- # longest_phrases_3 = gr.Textbox(label="Focus")
354
- # translated_phrases_output_3 = gr.Textbox(label="Translated Phrases")
355
- # audio_output_native_phrase_3 = gr.Audio(label="Audio Output (Native Language)")
356
- # audio_output_target_phrase_3 = gr.Audio(label="Audio Output (Target Language)")
357
-
358
- # def update_outputs(image, file, audio, text, input_language, target_language):
359
- # final_text, top_phrases, translations, audio_outputs = process_input(
360
- # image=image, file=file, audio=audio, text=text,
361
- # translatefrom=input_language, translateto=target_language
362
- # )
363
-
364
- # processed_text_output = final_text
365
- # audio_output_native_phrases = [native for _, native in audio_outputs]
366
- # audio_output_target_phrases = [target for target, _ in audio_outputs]
367
-
368
- # longest_phrases_outputs = top_phrases[:3]
369
- # translated_phrases_outputs = translations[:3]
370
- # audio_outputs_native = audio_output_native_phrases[:3]
371
- # audio_outputs_target = audio_output_target_phrases[:3]
372
-
373
- # return (
374
- # processed_text_output,
375
- # *audio_outputs_native,
376
- # *audio_outputs_target,
377
- # *longest_phrases_outputs,
378
- # *translated_phrases_outputs
379
- # )
380
-
381
- # process_button.click(
382
- # fn=update_outputs,
383
- # inputs=[image_input, file_input, audio_input, text_input, input_language, target_language],
384
- # outputs=[
385
- # processed_text_output,
386
- # audio_output_native_phrase_1, audio_output_target_phrase_1,
387
- # audio_output_native_phrase_2, audio_output_target_phrase_2,
388
- # audio_output_native_phrase_3, audio_output_target_phrase_3,
389
- # longest_phrases_1, translated_phrases_output_1,
390
- # longest_phrases_2, translated_phrases_output_2,
391
- # longest_phrases_3, translated_phrases_output_3
392
- # ]
393
- # )
394
-
395
- # if __name__ == "__main__":
396
- # main()
 
278
 
279
  outputs = [
280
  RichTextbox(label="Processed Text"),
281
+ gr.Audio(label="Audio"),
282
  gr.Textbox(label="Focus 1"),
283
  gr.Textbox(label="Translated Phrases 1"),
284
  gr.Audio(label="Audio Output (Native Language) 1"),
 
293
  gr.Audio(label="Audio Output (Target Language) 3")
294
  ]
295
  def update_outputs(inputlanguage, target_language, audio, image, text, file):
296
+ final_text, audio_output, top_phrases, translations, audio_outputs = process_input(
297
+ image=image, file=file, audio=audio, text=text,
298
+ translateto=target_language, translatefrom=inputlanguage
299
  )
300
  processed_text_output = final_text
301
  audio_output_native_phrases = [native for _, native in audio_outputs]
 
307
  audio_outputs_target = audio_output_target_phrases[:3]
308
 
309
  return (
310
+ processed_text_output,
311
+ audio_output,
312
  *audio_outputs_native,
313
  *audio_outputs_target,
314
  *longest_phrases_outputs,
 
322
  iface = gr.Interface(fn=interface_func, inputs=inputs, outputs=outputs, title=title, description=description)
323
 
324
  if __name__ == "__main__":
325
+ iface.launch()