Whataboutup commited on
Commit
1a5b279
·
verified ·
1 Parent(s): a3f5025

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import InterenceClient
3
+ client = InterenceClient("microsoft/phi-4")
4
+ def respond(message, history):
5
+ messages = [{"role": "system", "content": "You are a chatbot helping students make university options based on their current subjects and interests"}]
6
+ if history:
7
+ messages.extend(history)
8
+ messages.append({"role": "user", "content": message})
9
+ response = client.chat_completion(
10
+ messages,
11
+ max_token=100
12
+ )
13
+ return response['choices'][0]['message']['content'].strip()
14
+ chatbot = gr.ChatInterface(respond, type="messages", title="CASSI")
15
+ chatbot.launch()