Salt40404 commited on
Commit
6d720ba
·
verified ·
1 Parent(s): 37ff418

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -23
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
 
4
  def respond(message, history: list[dict[str, str]], hf_token: gr.OAuthToken):
5
  client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
6
 
@@ -30,33 +31,62 @@ Keep a simple, approachable, and friendly tone."""
30
 
31
  chatbot = gr.ChatInterface(respond, type="messages")
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  with gr.Blocks(css="""
34
- body {
35
- background-color: #fdfdfd; /* quase branco */
36
- font-family: 'Arial', sans-serif;
37
- }
38
- .gradio-container {
39
- border-radius: 25px; /* mais arredondado */
40
- padding: 20px;
41
- max-width: 700px;
42
- margin: 20px auto;
43
- background-color: #fefefe; /* fundo bem claro */
44
- box-shadow: 0 4px 20px rgba(0,0,0,0.05); /* sombra suave */
45
- }
46
- .chat-message {
47
- border-radius: 20px; /* mensagens arredondadas */
48
- padding: 10px 15px;
49
- margin: 5px 0;
50
- }
51
- .chat-message.user {
52
- background-color: #e6f0ff; /* bolha do usuário */
53
- }
54
- .chat-message.bot {
55
- background-color: #f0f0f0; /* bolha da IA */
56
- }
57
  """) as demo:
58
  with gr.Sidebar():
59
  gr.LoginButton()
 
 
 
 
60
  chatbot.render()
61
 
62
  if __name__ == "__main__":
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ # Função principal da IA
5
  def respond(message, history: list[dict[str, str]], hf_token: gr.OAuthToken):
6
  client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
7
 
 
31
 
32
  chatbot = gr.ChatInterface(respond, type="messages")
33
 
34
+ # HTML do ícone da BitAI
35
+ bit_icon_html = """
36
+ <div style="text-align:center; margin-bottom:10px;">
37
+ <div class="wrap" id="bit" style="width:100px; height:100px; margin:auto;">
38
+ <svg viewBox="0 0 160 160">
39
+ <circle class="face" cx="80" cy="80" r="72"/>
40
+ <circle class="dot eye-left"/>
41
+ <circle class="dot eye-right"/>
42
+ <circle class="dot extra-dot" cx="80" cy="78" r="8"/>
43
+ </svg>
44
+ </div>
45
+ <div class="label"><b>bitAI</b> — <span id="mode">normal</span></div>
46
+ </div>
47
+
48
+ <script>
49
+ const wrap = document.getElementById('bit');
50
+ const mode = document.getElementById('mode');
51
+ let thinking = false;
52
+ wrap.addEventListener('click', ()=>{
53
+ thinking = !thinking;
54
+ wrap.classList.toggle('thinking', thinking);
55
+ mode.textContent = thinking ? 'pensando...' : 'normal';
56
+ });
57
+ </script>
58
+
59
+ <style>
60
+ .face{ fill:#0b1020; }
61
+ .dot{ fill:#fff; transition: all 500ms ease; }
62
+ .eye-left { cx:56; cy:62; r:10; }
63
+ .eye-right { cx:104; cy:62; r:10; }
64
+ .wrap.thinking .eye-left { cx:48; cy:78; r:8; }
65
+ .wrap.thinking .eye-right { cx:112; cy:78; r:8; }
66
+ .extra-dot{ opacity:0; transform:translateY(10%); transition: all 500ms ease; }
67
+ .wrap.thinking .extra-dot{ opacity:1; transform:translateY(0); }
68
+ .wrap.thinking .dot{ animation: wave 1.4s infinite ease-in-out; }
69
+ .wrap.thinking .eye-left { animation-delay:0s; }
70
+ .wrap.thinking .extra-dot{ animation-delay:0.25s; }
71
+ .wrap.thinking .eye-right{ animation-delay:0.5s; }
72
+ @keyframes wave { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-12%); } }
73
+ .label{ text-align:center; font-family:sans-serif; color:#223; margin-top:4px;}
74
+ </style>
75
+ """
76
+
77
  with gr.Blocks(css="""
78
+ body { background-color: #f0f0f0; font-family: 'Arial', sans-serif; }
79
+ .gradio-container { border-radius: 25px; padding: 20px; max-width: 700px; margin: 20px auto; background-color: #fafafa; box-shadow: 0 4px 20px rgba(0,0,0,0.05);}
80
+ .chat-message { border-radius: 20px; padding: 10px 15px; margin: 5px 0;}
81
+ .chat-message.user { background-color: #dceefc; }
82
+ .chat-message.bot { background-color: #e8e8e8; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  """) as demo:
84
  with gr.Sidebar():
85
  gr.LoginButton()
86
+
87
+ # Coloca o ícone no topo da UI
88
+ gr.HTML(bit_icon_html)
89
+
90
  chatbot.render()
91
 
92
  if __name__ == "__main__":