NinjaTribe commited on
Commit
cee5498
·
verified ·
1 Parent(s): 7a85c27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  from huggingface_hub import InferenceClient
3
 
4
  """
@@ -7,14 +8,16 @@ For more information on `huggingface_hub` Inference API support, please check th
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
 
10
- def respond(
11
- message,
12
- history: list[tuple[str, str]],
13
- system_message,
14
- max_tokens,
15
- temperature,
16
- top_p,
17
- ):
 
 
18
  messages = [{"role": "system", "content": system_message}]
19
 
20
  for val in history:
 
1
  import gradio as gr
2
+ import os
3
  from huggingface_hub import InferenceClient
4
 
5
  """
 
8
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
 
10
 
11
+ PERSONALITY = os.environ.get("CHATBOT_PERSONALITY", "You are a helpful assistant.")
12
+
13
+ def chatbot(message, history):
14
+ custom_prompt = PERSONALITY + "\n\nUser: " + message + "\nChatbot:"
15
+ response = generate_response(custom_prompt, history) # Hypothetical function
16
+ history.append((message, response))
17
+ return history
18
+
19
+ def generate_response(prompt, history):
20
+ return "Olá! Eu sou Shinobi! E sou um especialista em cultura japonesa, ou tento ser pelo menos."
21
  messages = [{"role": "system", "content": system_message}]
22
 
23
  for val in history: