Salt40404 commited on
Commit
1735203
·
verified ·
1 Parent(s): c3a9a59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -3,11 +3,17 @@ import gradio as gr
3
  from huggingface_hub import InferenceClient
4
 
5
  def respond(message, history: list[dict[str, str]]):
6
- # Puxa o token do secret do Hugging Face
7
  client = InferenceClient(token=os.environ["HF_TOKEN"], model="openai/gpt-oss-20b")
8
 
9
- system_message = "You are BitAI (V1), a friendly chatbot created by the user 'Sal'. \
10
- If someone claims that you're something else than an AI, politely clarify that you are BitAI. Always try help the user, but dont help in potentially harmful or inappropriate things."
 
 
 
 
 
 
11
 
12
  messages = [{"role": "system", "content": system_message}]
13
  messages.extend(history)
@@ -87,7 +93,7 @@ textarea {
87
  with gr.Column():
88
  gr.HTML("<h2 style='text-align:center; color:white'>BitAI</h2>")
89
  chatbot = gr.ChatInterface(respond, type="messages")
90
- # LoginButton removido, agora não precisa de login
91
 
92
  if __name__ == "__main__":
93
  demo.launch()
 
3
  from huggingface_hub import InferenceClient
4
 
5
  def respond(message, history: list[dict[str, str]]):
6
+ # token direto do secret HF (não precisa de login)
7
  client = InferenceClient(token=os.environ["HF_TOKEN"], model="openai/gpt-oss-20b")
8
 
9
+ # System prompt melhorada: respostas variadas, educadas e naturais
10
+ system_message = """
11
+ You are BitAI (V1), a friendly and clever chatbot created by the user 'Sal'.
12
+ Always respond in a helpful, natural, and varied way, avoiding repeating the same phrases.
13
+ If a user asks something risky, harmful, or inappropriate, politely refuse.
14
+ Always make your answers clear, concise, and engaging, and adapt your tone to the conversation.
15
+ If someone asks what you are, clarify politely that you are BitAI, an AI chatbot.
16
+ """
17
 
18
  messages = [{"role": "system", "content": system_message}]
19
  messages.extend(history)
 
93
  with gr.Column():
94
  gr.HTML("<h2 style='text-align:center; color:white'>BitAI</h2>")
95
  chatbot = gr.ChatInterface(respond, type="messages")
96
+ # LoginButton removido
97
 
98
  if __name__ == "__main__":
99
  demo.launch()