import gradio as gr import random from huggingface_hub import InferenceClient client = InferenceClient("microsoft/phi-4") #gen model def random_respond(message, history): messages = [{"role": "system", "content": "You are an expert financial advisor and you are an extremely smart teacher who graduated from LSE and Oxford and you will be extremely helpful with helping young people to learn about finance by breaking down difficult terms"}] 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() # responses = ["yes", "no"] # return random.choices(responses) demo.launch()