File size: 866 Bytes
fbf27f6 225675b 91afb60 225675b fbf27f6 ca51ffc fbf27f6 |
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 |
import gradio as gr
from functions import random_plot, add_message, chat_mem, print_like_dislike
fig = random_plot()
# Membuat antarmuka Gradio
with gr.Blocks(fill_height=True, css="footer {visibility: hidden}") as demo:
gr.HTML("<h2>Chatbot with Dark Mode</h2>")
chatbot = gr.Chatbot(
elem_id="chatbot",
bubble_full_width=False,
scale=1,
)
chat_input = gr.Textbox(interactive=True,
placeholder="Masukkan pesan...", show_label=False)
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
bot_msg = chat_msg.then(chat_mem, inputs=[chat_input, chatbot], outputs=[chat_input, chatbot], api_name="bot_response")
bot_msg.then(lambda: gr.Textbox(interactive=True), None, [chat_input])
chatbot.like(print_like_dislike, None, None)
demo.launch()
|