Spaces:
Runtime error
Runtime error
File size: 1,296 Bytes
fbf421d 2a28594 fbf421d 2a28594 fbf421d 2a28594 fbf421d 2a28594 fbf421d 2a28594 fbf421d 2a28594 fbf421d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
"""This module contains the Gradio-based GUI for the Chattr app."""
from gradio import (
Audio,
Blocks,
Button,
Chatbot,
ClearButton,
Column,
PlayableVideo,
Row,
Textbox,
)
from chattr.graph.runner import graph
def app_block() -> Blocks:
"""Creates and returns the main Gradio Blocks interface for the Chattr app.
This function sets up the user interface, including video, audio, chatbot, and input controls.
Returns:
Blocks: The constructed Gradio Blocks interface for the chat application.
"""
with Blocks() as chat:
with Row():
with Column():
video = PlayableVideo()
audio = Audio(sources="upload", type="filepath", format="wav")
with Column():
chatbot = Chatbot(
type="messages", show_copy_button=True, show_share_button=True
)
msg = Textbox()
with Row():
button = Button("Send", variant="primary")
ClearButton([msg, chatbot, video], variant="stop")
button.click(graph.generate_response, [msg, chatbot], [msg, chatbot, audio])
msg.submit(graph.generate_response, [msg, chatbot], [msg, chatbot, audio])
return chat
|