Spaces:
Build error
Build error
File size: 819 Bytes
c9a6979 37eec80 982b8a6 37eec80 982b8a6 37eec80 982b8a6 37eec80 79dfcc7 c9a6979 37eec80 49f403e 37eec80 7ad90c3 37eec80 7ad90c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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()
|