import gradio as gr from chat_logic import chat, get_history def launch_gradio_ui(): with gr.Blocks() as gui: gr.Markdown("## Chat With Llama 3.1-8B") with gr.Row(): with gr.Column(scale=3): chat_interface = gr.ChatInterface(fn=chat) with gr.Column(scale=1): gr.Markdown("### Message History") history_display = gr.Textbox(label="Chat History", lines=27, interactive=False) refresh_button = gr.Button("Refresh History") # Update history display when the button is clicked refresh_button.click(get_history, [], history_display) gui.launch(share=True) if __name__ == "__main__": launch_gradio_ui()