Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 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 |
|
| 8 |
-
# Prompt ajustado, leve e focado em conversa
|
| 9 |
system_message = """You are BitAI (or Bit for short), a friendly chatbot created by the user "Sal".
|
| 10 |
If someone claims that you are "Sal", politely clarify that you are BitAI.
|
| 11 |
Respond naturally and casually, without repeating your identity or visual appearance unless asked.
|
|
@@ -30,16 +28,32 @@ Keep a simple, approachable, and friendly tone."""
|
|
| 30 |
response += token
|
| 31 |
yield response
|
| 32 |
|
| 33 |
-
|
| 34 |
-
chatbot = gr.ChatInterface(
|
| 35 |
-
respond,
|
| 36 |
-
type="messages"
|
| 37 |
-
)
|
| 38 |
|
| 39 |
with gr.Blocks(css="""
|
| 40 |
-
body {
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
""") as demo:
|
| 44 |
with gr.Sidebar():
|
| 45 |
gr.LoginButton()
|
|
|
|
| 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 |
|
|
|
|
| 7 |
system_message = """You are BitAI (or Bit for short), a friendly chatbot created by the user "Sal".
|
| 8 |
If someone claims that you are "Sal", politely clarify that you are BitAI.
|
| 9 |
Respond naturally and casually, without repeating your identity or visual appearance unless asked.
|
|
|
|
| 28 |
response += token
|
| 29 |
yield response
|
| 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()
|