import gradio as gr
from Lang_chain import hello_langchain
import json
import os
# Load branding info
branding_path = os.path.join(os.path.dirname(__file__), 'branding.json')
with open(os.path.abspath(branding_path), "r") as f:
brand_info = json.load(f)["brand"]
# Create the Gradio interface
with gr.Blocks(title=brand_info["organizationName"]) as demo:
# Branding logo at top
gr.HTML(f'''
''')
# Chat interface
gr.ChatInterface(
fn= hello_langchain,
title=brand_info["organizationName"],
description=brand_info["slogan"],
examples=[
["What is AI?"],
["Can you explain machine learning!"],
["How does a neural network work?"],
["What is natural language processing?"],
["Tell me about computer vision."]
],
chatbot=gr.Chatbot(type="messages"),
type="messages" # <== This line silences the warning
)
# Optional if running via `python ui.py`
demo.launch()