1234567891011121314151617181920212223242526272829303132333435363738 |
- import gradio as gr
- from iva import IVA
- def IVA_demo(audio, text):
- assistant = IVA()
- if audio:
- print("Am a")
- transcript = assistant.transcript(audio)
- else:
- transcript = text
- query_result = assistant.process_query(transcript)
- audio_path = assistant.tts(query_result)
- return query_result, audio_path
- demo = gr.Interface(
- fn=IVA_demo,
- inputs=[
- gr.Audio(
- type="filepath",
- sources="microphone",
- label="Voice input",
- show_label=True,
- ),
- gr.Textbox(info="...or use text input"),
- ],
- outputs=[
- "text",
- gr.Audio(type="filepath"),
- ],
- )
- demo.launch(share=True)
|