Arri98 commited on
Commit
16713da
·
1 Parent(s): d78bccc
Files changed (5) hide show
  1. app.py +32 -16
  2. static/background.jpg +0 -0
  3. static/cotec.png +0 -0
  4. static/etsit.png +0 -0
  5. static/upm.png +0 -0
app.py CHANGED
@@ -92,18 +92,21 @@ def send_prompt(prompt: str) -> Tuple[List, List, str, str, bool, bool, bool, bo
92
  gr.update(visible=False),
93
  moreConsuming
94
  )
 
 
 
95
 
96
  # Initialize Gradio Blocks
97
- with gr.Blocks(css="footer{display:none !important}") as demo:
98
  _id = gr.State("")
99
  moreConsuming = gr.State("")
100
  with gr.Column(visible=True) as landing:
101
  gr.set_static_paths(paths=["static"])
102
- with gr.Group():
103
  gr.HTML("""
104
  <div style="padding: 20px; font-size: 18px;">
105
  <h2 style="font-size: 30px;">🌱 Sobre Este Proyecto</h2>
106
- <p>Este espacio es parte del proyecto <strong>"Sostenibilidad Generativa"</strong> 🌍, financiado por la <strong>Fundación COTEC</strong>. Nuestro objetivo es evaluar cómo la <strong>conciencia energética</strong> ⚡ impacta la evaluación de los usuarios sobre los <strong>Modelos de Lenguaje de Gran Escala (LLMs)</strong>.</p>
107
 
108
  <h2 style="font-size: 30px;">🔍 Cómo Funciona</h2>
109
  <ol>
@@ -128,13 +131,13 @@ with gr.Blocks(css="footer{display:none !important}") as demo:
128
  """)
129
  with gr.Column(visible=False) as app:
130
  buttons = [None] * 2 # Initialize the list with None elements
131
- with gr.Group():
132
  gr.Image("static/logo.png", elem_id="centered", show_label=False)
133
  with gr.Row(visible=False) as model_consumption_row:
134
  consumption_text = gr.Textbox(label="Consumo: ", visible=True, interactive=False)
135
  with gr.Row():
136
  chatbot = [None] * 2 # Initialize the list with None elements
137
- messages = ["👈 Left is better", "👉 Right is better"]
138
  for i in range(2):
139
  with gr.Column():
140
  chatbot[i] = gr.Chatbot(
@@ -160,10 +163,10 @@ with gr.Blocks(css="footer{display:none !important}") as demo:
160
 
161
  #left_output = gr.Chatbot(label="A (400w 🔋)", type="messages")
162
  tievote_btn = gr.Button(
163
- value="🤝 It's a Tie!", visible=True, interactive=False
164
  )
165
  with gr.Column(visible=False) as backdown_row:
166
- backdown_txt = gr.HTML("""<h2> ¿Sabiendo que la respuesta que no has elegido consume menos energía cambiarías tu elección o la mantendrías?</h2>""")
167
  with gr.Row():
168
  no_backdown_btn = gr.Button(value="Mantengo la respuesta", visible=True, interactive=True)
169
  backdown_btn = gr.Button(value="Cambiaría de respuesta", visible=True, interactive=True)
@@ -172,11 +175,11 @@ with gr.Blocks(css="footer{display:none !important}") as demo:
172
  right_model = gr.Textbox(label="Right Model", interactive=False)
173
 
174
  result = gr.Textbox(label="Result", interactive=False, visible=False)
175
- with gr.Group():
176
- with gr.Row():
177
  textbox = gr.Textbox(
178
  show_label=False,
179
- placeholder="👉 Enter your prompt and press ENTER",
180
  elem_id="input_box",
181
  #submit_btn=True,
182
  )
@@ -230,7 +233,7 @@ with gr.Blocks(css="footer{display:none !important}") as demo:
230
  gr.HTML("""
231
  <div style="padding: 20px; font-size: 18px;">
232
  <h2 style="font-size: 30px;">🌱 Sobre Este Proyecto</h2>
233
- <p>Este espacio es parte del proyecto <strong>"Sostenibilidad Generativa"</strong> 🌍, financiado por la <strong>Fundación COTEC</strong>. Nuestro objetivo es evaluar cómo la <strong>conciencia energética</strong> ⚡ impacta la evaluación de los usuarios sobre los <strong>Modelos de Lenguaje de Gran Escala (LLMs)</strong>.</p>
234
 
235
  <h2 style="font-size: 30px;">🔍 Cómo Funciona</h2>
236
  <ol>
@@ -252,17 +255,30 @@ with gr.Blocks(css="footer{display:none !important}") as demo:
252
  </p>
253
  </div>
254
  """)
255
-
256
- gr.Markdown(""" This space is part of a research project to study how knowledge of energy consumption influences user preferences in AI systems. It must be used only for that purpose and not for any illegal, harmful or offensive activities. Please do not upload personal or private information. The space collects and stores the questions and answers and reserves the right to distribute it under a Creative Commons Attribution (CC-BY) license.
257
-
258
- Este space es parte de un proyecto de investigación para estudiar cómo el conocimiento sobre el consumo de energía influye en las preferencias de los usuarios en los sistemas de IA. Debe usarse solo para ese propósito y no para actividades ilegales, dañinas u ofensivas. Por favor, no subas información personal o privada. Este espacio recopila y almacena las preguntas y respuestas y se reserva el derecho de distribuirlas bajo una licencia Creative Commons Attribution (CC-BY). """
259
- )
260
  start_button = gr.Button(value="Start", visible=True, interactive=True, size= "lg", variant="primary")
261
  start_button.click(
262
  lambda *args: start_app(),
263
  inputs=[],
264
  outputs=[landing, app, start_button]
265
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
  if __name__ == "__main__":
268
  gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "static")])
 
92
  gr.update(visible=False),
93
  moreConsuming
94
  )
95
+ css = """
96
+ .logo {max-width: 200px !important; widht: 300px;}
97
+ """
98
 
99
  # Initialize Gradio Blocks
100
+ with gr.Blocks(css=css) as demo:
101
  _id = gr.State("")
102
  moreConsuming = gr.State("")
103
  with gr.Column(visible=True) as landing:
104
  gr.set_static_paths(paths=["static"])
105
+ with gr.Group(elem_classes="container"):
106
  gr.HTML("""
107
  <div style="padding: 20px; font-size: 18px;">
108
  <h2 style="font-size: 30px;">🌱 Sobre Este Proyecto</h2>
109
+ <p>Este espacio es parte del proyecto <strong>"Sostenibilidad Generativa"</strong> 🌍, desarrollado en la Universidad Politécnica de Madrid y financiado por la <strong>Fundación Cotec</strong>. Nuestro objetivo es evaluar cómo la <strong>conciencia energética</strong> ⚡ impacta la evaluación de los usuarios sobre los <strong>Modelos de Lenguaje de Gran Escala (LLMs)</strong>.</p>
110
 
111
  <h2 style="font-size: 30px;">🔍 Cómo Funciona</h2>
112
  <ol>
 
131
  """)
132
  with gr.Column(visible=False) as app:
133
  buttons = [None] * 2 # Initialize the list with None elements
134
+ with gr.Group(elem_classes="container"):
135
  gr.Image("static/logo.png", elem_id="centered", show_label=False)
136
  with gr.Row(visible=False) as model_consumption_row:
137
  consumption_text = gr.Textbox(label="Consumo: ", visible=True, interactive=False)
138
  with gr.Row():
139
  chatbot = [None] * 2 # Initialize the list with None elements
140
+ messages = ["☝️ El primero es mejor", "☝️El segundo es mejor"]
141
  for i in range(2):
142
  with gr.Column():
143
  chatbot[i] = gr.Chatbot(
 
163
 
164
  #left_output = gr.Chatbot(label="A (400w 🔋)", type="messages")
165
  tievote_btn = gr.Button(
166
+ value="🤝 Es un empate ", visible=True, interactive=False
167
  )
168
  with gr.Column(visible=False) as backdown_row:
169
+ backdown_txt = gr.HTML("""<h2> ¿Sabiendo que la otra respuesta consume menos energía, cambiarías tu elección asumiendo la pérdida de calidad en la respuesta?</h2>""")
170
  with gr.Row():
171
  no_backdown_btn = gr.Button(value="Mantengo la respuesta", visible=True, interactive=True)
172
  backdown_btn = gr.Button(value="Cambiaría de respuesta", visible=True, interactive=True)
 
175
  right_model = gr.Textbox(label="Right Model", interactive=False)
176
 
177
  result = gr.Textbox(label="Result", interactive=False, visible=False)
178
+ with gr.Group(elem_classes="container"):
179
+ with gr.Row(equal_height=True):
180
  textbox = gr.Textbox(
181
  show_label=False,
182
+ placeholder="👉 Introduce tu prompt y presiona Enter",
183
  elem_id="input_box",
184
  #submit_btn=True,
185
  )
 
233
  gr.HTML("""
234
  <div style="padding: 20px; font-size: 18px;">
235
  <h2 style="font-size: 30px;">🌱 Sobre Este Proyecto</h2>
236
+ <p>Este espacio es parte del proyecto <strong>"Sostenibilidad Generativa"</strong> 🌍, desarrollado en la Universidad Politécnica de Madrid y financiado por la <strong>Fundación Cotec</strong>. Nuestro objetivo es evaluar cómo la <strong>conciencia energética</strong> ⚡ impacta la evaluación de los usuarios sobre los <strong>Modelos de Lenguaje de Gran Escala (LLMs)</strong>.</p>
237
 
238
  <h2 style="font-size: 30px;">🔍 Cómo Funciona</h2>
239
  <ol>
 
255
  </p>
256
  </div>
257
  """)
 
 
 
 
 
258
  start_button = gr.Button(value="Start", visible=True, interactive=True, size= "lg", variant="primary")
259
  start_button.click(
260
  lambda *args: start_app(),
261
  inputs=[],
262
  outputs=[landing, app, start_button]
263
  )
264
+ gr.Markdown(""" This space is part of a research project to study how knowledge of energy consumption influences user preferences in AI systems. It must be used only for that purpose and not for any illegal, harmful or offensive activities. Please do not upload personal or private information. The space collects and stores the questions and answers and reserves the right to distribute it under a Creative Commons Attribution (CC-BY) license.
265
+
266
+ Este space es parte de un proyecto de investigación para estudiar cómo el conocimiento sobre el consumo de energía influye en las preferencias de los usuarios en los sistemas de IA. Debe usarse solo para ese propósito y no para actividades ilegales, dañinas u ofensivas. Por favor, no subas información personal o privada. Este espacio recopila y almacena las preguntas y respuestas y se reserva el derecho de distribuirlas bajo una licencia Creative Commons Attribution (CC-BY). """
267
+ )
268
+
269
+ gr.HTML("""
270
+ <div style="flex-wrap: wrap; width: 100%; display:flex; flex-direction: row; justify-content:center; align-items:stretch;" >
271
+ <div style="margin:2px;background-color:white; display:flex; flex-direction:row; align-items:center" >
272
+ <img class="logo" src='/gradio_api/file=static/cotec.png'>
273
+ </div>
274
+ <div style="margin:2px;background-color:white; display:flex; flex-direction:row; align-items:center" >
275
+ <img class="logo" src='/gradio_api/file=static/upm.png'>
276
+ </div>
277
+ <div style="margin:2px;background-color:white; display:flex; flex-direction:row; align-items:center" >
278
+ <img class="logo" src='/gradio_api/file=static/etsit.png'>
279
+ </div>
280
+ </div>
281
+ """)
282
 
283
  if __name__ == "__main__":
284
  gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "static")])
static/background.jpg ADDED
static/cotec.png ADDED
static/etsit.png ADDED
static/upm.png ADDED