Whataboutup commited on
Commit
aa1c1ab
·
verified ·
1 Parent(s): 7368c1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,9 +1,15 @@
1
  import gradio as gr
2
  import random #added here
3
- def respond_yes_no_randomly(message, history):
4
- responses = ["yes", "No"]#added here
5
- return random.choice(responses)#added here
 
 
 
 
 
 
6
  print("hello, Princess")
7
- chatbot = gr.ChatInterface(respond_yes_no_randomly, type="messages", title="Personal Yes or No Woman")
8
 
9
  chatbot.launch()
 
1
  import gradio as gr
2
  import random #added here
3
+ from huggingfaceface_hub import InferenceClient
4
+ client = InferenceClient("microsoft/phi-4")
5
+ def respond(message,history):
6
+ messages = [{"role":"system", "content": "You are a friendly chatbot!"}]
7
+ if history:
8
+ messages.extend(history)
9
+ messages.append({"role": "user", "content":message})
10
+ response = client.chat_completion(messages, max_token=100)
11
+ returnresponse['choices'][0]['message']['content'].strip()
12
  print("hello, Princess")
13
+ chatbot = gr.ChatInterface(respond, type="messages", title="Personal ChatWoman")
14
 
15
  chatbot.launch()