Programer123 commited on
Commit
e616a60
·
verified ·
1 Parent(s): 83d5461

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -1,13 +1,7 @@
1
  import gradio as gr
2
- import time
3
 
4
  def responder(message, history):
5
- resposta = f"Recebi a tua mensagem: '{message}'. Este é um chatbot principal em Gradio com visual simples e limpo."
6
- texto = ""
7
- for palavra in resposta.split():
8
- texto += palavra + " "
9
- time.sleep(0.03)
10
- yield texto
11
 
12
  theme = gr.themes.Soft(
13
  primary_hue="blue",
@@ -26,16 +20,21 @@ theme = gr.themes.Soft(
26
  custom_css = """
27
  #title-box {
28
  text-align: center;
29
- padding: 20px 10px 10px 10px;
30
  }
31
  #title-box h1 {
32
- font-size: 2.2rem;
33
  margin-bottom: 8px;
34
  }
35
  #title-box p {
36
  color: #cbd5e1;
37
  font-size: 1rem;
38
  }
 
 
 
 
 
39
  footer {display: none !important;}
40
  """
41
 
@@ -43,19 +42,19 @@ with gr.Blocks(fill_height=True) as demo:
43
  gr.HTML("""
44
  <div id="title-box">
45
  <h1>🤖 Meu Chatbot</h1>
46
- <p>Um chatbot feito em Gradio como interface principal.</p>
47
  </div>
48
  """)
49
 
50
- gr.ChatInterface(
51
- fn=responder,
52
- examples=[
53
- "Olá, quem és tu?",
54
- "Explica-me o que é Gradio.",
55
- "Dá-me ideias para um projeto em Python.",
56
- "Como posso criar um chatbot mais bonito?"
57
- ]
58
- )
59
 
60
  if __name__ == "__main__":
61
  demo.launch(
 
1
  import gradio as gr
 
2
 
3
  def responder(message, history):
4
+ return f"Tu disseste: {message}"
 
 
 
 
 
5
 
6
  theme = gr.themes.Soft(
7
  primary_hue="blue",
 
20
  custom_css = """
21
  #title-box {
22
  text-align: center;
23
+ padding: 30px 10px 10px 10px;
24
  }
25
  #title-box h1 {
26
+ font-size: 2.4rem;
27
  margin-bottom: 8px;
28
  }
29
  #title-box p {
30
  color: #cbd5e1;
31
  font-size: 1rem;
32
  }
33
+ #chat-wrap {
34
+ max-width: 950px;
35
+ margin: 0 auto;
36
+ padding-bottom: 30px;
37
+ }
38
  footer {display: none !important;}
39
  """
40
 
 
42
  gr.HTML("""
43
  <div id="title-box">
44
  <h1>🤖 Meu Chatbot</h1>
45
+ <p>Teste simples para confirmar que o bot responde.</p>
46
  </div>
47
  """)
48
 
49
+ with gr.Column(elem_id="chat-wrap"):
50
+ gr.ChatInterface(
51
+ fn=responder,
52
+ examples=[
53
+ "Olá",
54
+ "Como estás?",
55
+ "Explica-me o que é Gradio"
56
+ ]
57
+ )
58
 
59
  if __name__ == "__main__":
60
  demo.launch(