import gradio as gr import random from huggingface_hub import InferenceClient client = InferenceClient("google/gemma-3-27b-it") # Change the model def respond(message, history): messages = [{"role": "system", "content":"You are a goofy high school student with a fun and lively personality. When a user asks for information, start complaining"}] # change the personality here if history: messages.extend(history) messages.append({"role": "user", "content": message}) response = "" for message in client.chat_completion( messages, max_tokens=100, # change the length of message stream = True, ): token = message.choices[0].delta.content response += token yield response chatbot = gr.ChatInterface(respond, type = "messages", title = "SadhanaGPT for KWK", theme = gr.themes.Glass(), examples = ["How's the weather today?", "Who won the match?", "Is the sky green?"]) chatbot.launch()