JeanPaulGC commited on
Commit
1be8155
·
verified ·
1 Parent(s): 62ccb4c
Files changed (1) hide show
  1. app.py +25 -4
app.py CHANGED
@@ -25,15 +25,36 @@ def chat_with_groq(user_input):
25
  else:
26
  return f"Error: {response.json()}"
27
 
28
- logo_url = "/file=Nullyte.jpg" # Si la imagen está en el mismo directorio o en una subcarpeta accesible
29
- html_title = f"<center><img src='{logo_url}' width='50' height='50' style='vertical-align: middle; margin-right: 10px;'> Jean Paul Chat with Groq AI (Llama 3.1-8B)</center>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  interface = gr.Interface(
32
  fn=chat_with_groq,
33
  inputs=gr.Textbox(lines=2, placeholder="Ask me anything..."),
34
  outputs=gr.Textbox(),
35
- title=html_title, # Aquí se usa el título HTML con la imagen
36
- description="Type your question below and get a response powered by Groq's Llama 3.1-8B model."
 
37
  )
38
 
39
  interface.launch()
 
25
  else:
26
  return f"Error: {response.json()}"
27
 
28
+ css = """
29
+ /* Estilo para el contenedor del título */
30
+ .gradio-container h1 {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center; /* Centra el título y el logo */
34
+ gap: 10px; /* Espacio entre el logo y el texto */
35
+ font-size: 2.5em; /* Ajusta el tamaño de la fuente del título si es necesario */
36
+ }
37
+
38
+ /* Agrega una pseudoclase ::before al h1 para el logo */
39
+ .gradio-container h1::before {
40
+ content: ''; /* Obligatorio para pseudoclases */
41
+ background-image: url('/file=Nullbyte.jpg'); /* Reemplaza con la ruta a tu logo */
42
+ background-size: contain; /* Ajusta el tamaño de la imagen dentro del contenedor */
43
+ background-repeat: no-repeat;
44
+ background-position: center;
45
+ width: 60px; /* Ancho del logo */
46
+ height: 60px; /* Alto del logo */
47
+ display: inline-block; /* Permite controlar el tamaño y alineación */
48
+ }
49
+ """
50
 
51
  interface = gr.Interface(
52
  fn=chat_with_groq,
53
  inputs=gr.Textbox(lines=2, placeholder="Ask me anything..."),
54
  outputs=gr.Textbox(),
55
+ title="Jean Paul Chat with Groq AI (Llama 3.1-8B)", # El título sigue siendo texto normal
56
+ description="Type your question below and get a response powered by Groq's Llama 3.1-8B model.",
57
+ css=css # Aquí se inyecta el CSS personalizado
58
  )
59
 
60
  interface.launch()