# Import modules from other files
from chatbot import chatbot, model_inference, EXAMPLES
from live_chat import videochat
# Define Gradio theme
theme = gr.themes.Soft(
primary_hue="black",
secondary_hue="purple",
neutral_hue="gray",
font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif']
).set(
body_background_fill_dark="#111111",
block_background_fill_dark="#111111",
block_border_width="1px",
block_title_background_fill_dark="#1e1c26",
input_background_fill_dark="#292733",
button_secondary_background_fill_dark="#24212b",
border_color_primary_dark="#343140",
background_fill_secondary_dark="#111111",
color_accent_soft_dark="transparent"
)
# TODO: Debug voice block
with gr.Blocks() as voice:
gr.Markdown("VoiceChat")
gr.html ("")
# Chat interface block
with gr.Blocks(
fill_height=True,
css=""".gradio-container .avatar-container {height: 40px width: 40px !important;} #duplicate-button {margin: auto; color: white; background: #f1a139; border-radius: 100vh; margin-top: 2px; margin-bottom: 2px;}""",
) as chat:
gr.Markdown("### Chat with Image, Chat with Video, Image Generation and Normal Chat")
gr.ChatInterface(
fn=model_inference,
chatbot=chatbot,
examples=EXAMPLES,
multimodal=True,
cache_examples=False,
additional_inputs=[
gr.Checkbox(label="Web Search", value=False),
],
)
# Live chat interface block
with gr.Blocks() as livechat:
gr.Interface(
fn=videochat,
inputs=[gr.Image(type="PIL",sources="webcam", label="Upload Image"), gr.Textbox(label="Prompt", value="what he is doing")],
outputs=gr.Textbox(label="Answer")
)
# TODO: Update image block (hfspaces)
with gr.Blocks() as image:
gr.HTML("")
#Instant2 block
with gr.Blocks() as instant2:
gr.HTML("")
# Video diffusion block [TODO: Add more models]
with gr.Blocks() as video:
gr.Markdown("Model list needs updating")
gr.TabbedInterface([ instant2], ['Instant Vid'])
# Music diffusion block [TODO: add audio model HFSpace]
with gr.Blocks() as music:
gr.Markdown("Coming Soon!")
# gr.HTML("{HF SPACE IFRAME EMBEDDING}")
# Main application block
with gr.Blocks(theme=theme, title="ChatLABS powered by FallnAI") as demo:
gr.Markdown("# ChatLABS")
gr.TabbedInterface([chat, voice, livechat, image, video, music], ['AIChat',' VoiceChat','VideoChat', 'Diffusion Engine', ' Video Diffusion','Music Diffusion(Coming Soon)'])
demo.queue(max_size=300)
demo.launch()