import gradio as gr from huggingface_hub import InferenceClient #from sentence_transformers import SentenceTransformer #import torch #import numpy as np # import libraries client = InferenceClient("microsoft/phi-4") def respond(message, history): #context = get_relevent_context(message, top_k=3) messages = [{"role": "system", "content": "You are a friendly kpop expert chatbot."}] if history: messages.extend(history) messages.append({"role": "user", "content": message}) response = client.chat_completion( messages, max_tokens=10000 ) return response['choices'][0]['message']['content'].strip() chatbot = gr.ChatInterface(respond, type="messages") title = "Kpop chatbot" topics = """
πŸ‘‹ Hey Kpop fan!
Whether you’re new to the fandom or a longtime stan, I’m your ultimate Kpop buddy here to spill all the tea β˜•οΈ, trivia 🧠, and facts πŸ“š about your favorite groups and idols! 🌟

Want to find your perfect group or bias? Just ask me! πŸ’œπŸŽ€

Not only that, if you love an artist outside of Kpop, I can help you discover similar vibes and styles from the amazing world of Kpop too! 🎧✨

So whether you’re looking for your first bias or your next obsession, I’ve got you covered.
Let’s dive into the colorful, energetic, and ever-growing universe of Kpop together! πŸš€πŸ’«
""" disclaimer = "" css = """ .big-text { font-size: 100px; font-weight: bold; } .big-paragraph { font-size: 100px; line-height: 3; } """ with gr.Blocks() as chatbot: with gr.Row(): with gr.Column(scale=1): # ← LEFT COLUMN (sidebar) gr.Markdown(title) # Shows your "# :rocket: Lift Off :rocket: "heading gr.Markdown(topics) # Shows your welcome text & bullet list with gr.Column(scale=2): # ← RIGHT COLUMN (main chat area) gr.ChatInterface( fn=respond, type="messages" ) with gr.Row(): gr.Markdown(disclaimer) # Footer disclaimer text chatbot.launch()