File size: 780 Bytes
ed84fed
 
 
 
 
 
 
 
 
 
 
 
 
5ada7ef
ed84fed
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from LLMwithvoice import gradio_interface

# Create the Gradio interface
iface = gr.Interface(
    fn=gradio_interface,
    inputs=[
        gr.Textbox(type="password", lines=1, label="Hugging Face API Token", placeholder="Enter your Hugging Face API token here..."),
        gr.Textbox(lines=2, label="Context", placeholder="Enter the context here..."),
        gr.Textbox(lines=1, label="Question", placeholder="Enter your question here...")
    ],
    outputs=[
        gr.Textbox(label="Answer"),
        gr.Audio(label="Answer as Speech")
    ],
    title="Chat with Roberta with Voice",
    description="Ask questions based on a provided context using the Roberta model and hear the response via text-to-speech."
)

# Launch the Gradio app
iface.launch()