Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,13 @@ from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
|
3 |
import torch
|
4 |
import theme
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
theme = theme.Theme()
|
7 |
|
8 |
import os
|
@@ -36,25 +43,36 @@ from pydantic import BaseModel
|
|
36 |
import shutil
|
37 |
|
38 |
|
39 |
-
|
40 |
custom_title = "<span style='color: rgb(243, 239, 224);'>Green Greta</span>"
|
41 |
|
42 |
|
43 |
# Cell 1: Image Classification Model
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
def predict_image(input_img):
|
47 |
-
predictions = image_pipeline(input_img)
|
48 |
-
return {p["label"]: p["score"] for p in predictions}
|
49 |
|
50 |
-
image_gradio_app = gr.Interface(
|
51 |
-
fn=predict_image,
|
52 |
-
inputs=gr.Image(label="Image", sources=['upload', 'webcam'], type="pil"),
|
53 |
-
outputs=[gr.Label(label="Result")],
|
54 |
-
title=custom_title,
|
55 |
-
theme=theme
|
56 |
-
)
|
57 |
|
|
|
58 |
loader = WebBaseLoader(["https://www.epa.gov/recycle/frequent-questions-recycling", "https://www.whitehorsedc.gov.uk/vale-of-white-horse-district-council/recycling-rubbish-and-waste/lets-get-real-about-recycling/", "https://www.teimas.com/blog/13-preguntas-y-respuestas-sobre-la-ley-de-residuos-07-2022", "https://www.molok.com/es/blog/gestion-de-residuos-solidos-urbanos-rsu-10-dudas-comunes", "https://espanol.epa.gov/espanol/el-reciclaje#valelapena","https://espanol.epa.gov/espanol/preguntas-frecuentes-sobre-reciclado-de-plastico-y-elaboracion-de-abono-vegetal","https://espanol.epa.gov/espanol/consejo-del-dia-como-reciclo-mis","https://espanol.epa.gov/espanol/recursos-para-reciclar-dispositivos-electronicos","https://www.epa.gov/recycle/electronics-donation-and-recycling","https://reducereutilizarecicla.org/que-es-el-reciclaje/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/", "https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-amarillo/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-azul/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-verde/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-marron-organico/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-gris-restos/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/punto-limpio/", "https://reducereutilizarecicla.org/donde-tirar-auriculares/","https://reducereutilizarecicla.org/donde-tirar-sartenes/","https://reducereutilizarecicla.org/donde-tirar-aceite-usado/","https://reducereutilizarecicla.org/como-se-reciclan-los-envases-tipo-brik/","https://reducereutilizarecicla.org/los-envases-del-verano/", "https://reducereutilizarecicla.org/donde-tirar-radiografias/","https://reducereutilizarecicla.org/envases-ecologicos/","https://reducereutilizarecicla.org/donde-tirar-los-restos-de-pintura/","https://reducereutilizarecicla.org/valorizacion-de-residuos/","https://reducereutilizarecicla.org/como-reciclar-pilas/","https://reducereutilizarecicla.org/como-reciclar-capsulas-de-cafe/","https://reducereutilizarecicla.org/reciclando-cd/", "https://reducereutilizarecicla.org/donde-tirar-neumaticos/","https://reducereutilizarecicla.org/como-reciclar-una-canasta-de-mimbre/","https://reducereutilizarecicla.org/como-funciona-el-contenedor-amarillo/", "https://reducereutilizarecicla.org/donde-se-tiran-los-vapers/","https://reducereutilizarecicla.org/cuanto-tarda-una-bolsa-biodegradable-en-degradarse/", "https://reducereutilizarecicla.org/donde-se-reciclan-los-juguetes/","https://reducereutilizarecicla.org/objetos-que-se-pueden-reutilizar/","https://reducereutilizarecicla.org/la-parafina-se-puede-reutilizar/","https://reducereutilizarecicla.org/planta-de-reciclaje-de-papel/", "https://reducereutilizarecicla.org/como-saber-si-un-envase-es-reciclable/", "https://reducereutilizarecicla.org/reutilizar-vasos-de-vela/", "https://reducereutilizarecicla.org/bolsas-frio-calor/", "https://reducereutilizarecicla.org/reciclar-y-reutilizar-materiales-de-construccion/", "https://reducereutilizarecicla.org/que-es-exactamente-el-pet/", "https://reducereutilizarecicla.org/tipos-de-reciclaje/", "https://reducereutilizarecicla.org/que-hacer-con-palets-reciclados/", "https://reducereutilizarecicla.org/vertederos-controlados/", "https://reducereutilizarecicla.org/donde-tirar-escombros/","https://reducereutilizarecicla.org/como-reciclar-los-residuos-de-ps-poliestireno/","https://reducereutilizarecicla.org/tirar-la-basura-sin-bolsas/","https://reducereutilizarecicla.org/tirar-el-palo-de-la-fregona/","https://reducereutilizarecicla.org/la-mejor-manera-de-reciclar-una-pala-de-padel/", "https://reducereutilizarecicla.org/sabes-donde-tirar-las-llantas-viejas-de-un-coche/","https://reducereutilizarecicla.org/sabes-donde-tirar-el-arbol-de-navidad/","https://reducereutilizarecicla.org/clavos-tornillos-herramientas-donde-tirar-hierro/","https://reducereutilizarecicla.org/donde-tirar-un-secador-de-pelo-contenedor-o-punto-limpio/","https://reducereutilizarecicla.org/donde-tirar-electrodomesticos/","https://reducereutilizarecicla.org/donde-puedo-tirar-ramas-de-arboles/", "https://reducereutilizarecicla.org/donde-tirar-escombros/","https://reducereutilizarecicla.org/donde-se-tira-el-muerdago-quemado/","https://reducereutilizarecicla.org/sandalias-caucho-reciclado-neumaticos/","https://reducereutilizarecicla.org/ideas-para-reciclar-aspas-de-ventilador-de-techo/","https://reducereutilizarecicla.org/reciclar-sacos-dormir/","https://reducereutilizarecicla.org/reciclar-sillas-playa/","https://reducereutilizarecicla.org/donde-tirar-antipolillas/","https://reducereutilizarecicla.org/que-hacer-con-los-juguetes-viejos/","https://reducereutilizarecicla.org/como-utilizar-las-mascarillas-y-el-gel-hidroalcoholico-en-la-playa/","https://reducereutilizarecicla.org/ideas-para-reciclar-un-ventilador-de-pie/","https://reducereutilizarecicla.org/donde-tirar-gasoil/","https://reducereutilizarecicla.org/donde-puedo-tirar-basura-electronica/","https://reducereutilizarecicla.org/donde-tirar-agujas/", "https://reducereutilizarecicla.org/donde-tirar-residuos-peligrosos/", "https://reducereutilizarecicla.org/donde-tirar-los-cables/", "https://reducereutilizarecicla.org/donde-tirar-bicicletas/", "https://reducereutilizarecicla.org/donde-tirar-maletas/", "https://reducereutilizarecicla.org/como-reciclar-una-pantalla/", "https://reducereutilizarecicla.org/metales-reciclables/","https://reducereutilizarecicla.org/donde-tirar-caja-de-helado/", "https://reducereutilizarecicla.org/como-reciclar-perchas-de-plastico/","https://reducereutilizarecicla.org/donde-tirar-un-jarron-de-ceramica/","https://reducereutilizarecicla.org/donde-tirar-sanitarios/", "https://reducereutilizarecicla.org/reciclar-bombonas-de-camping-gas/", "https://reducereutilizarecicla.org/donde-tirar-aceite-usado-de-motor/", "https://reducereutilizarecicla.org/como-reciclar-rotuladores-subrayadores-y-boligrafos/", "https://reducereutilizarecicla.org/donde-tirar-un-ordenador/", "https://reducereutilizarecicla.org/donde-tirar-un-termometro-de-mercurio/", "https://reducereutilizarecicla.org/tirar-nevera-vieja/","https://reducereutilizarecicla.org/que-cosas-pueden-ser-recicladas/","https://reducereutilizarecicla.org/donde-tirar-los-pintaunas/","https://reducereutilizarecicla.org/donde-tirar-bombona-de-helio/", "https://reducereutilizarecicla.org/donde-tirar-alfombras/", "https://reducereutilizarecicla.org/donde-tirar-impresoras-y-sus-cartuchos-o-toner/", "https://reducereutilizarecicla.org/donde-tirar-aguarras/","https://reducereutilizarecicla.org/donde-tirar-discos-duros/","https://reducereutilizarecicla.org/donde-tirar-azulejos/","https://reducereutilizarecicla.org/donde-tirar-diapositivas/","https://reducereutilizarecicla.org/donde-tirar-jeringuillas-usadas/","https://reducereutilizarecicla.org/donde-tirar-cintas-vhs/","https://reducereutilizarecicla.org/donde-tirar-gomaespuma/", "https://reducereutilizarecicla.org/donde-tirar-los-botes-de-pintura/", "https://reducereutilizarecicla.org/donde-se-recicla-la-madera/", "https://reducereutilizarecicla.org/donde-tirar-discos-de-vinilo/", "https://reducereutilizarecicla.org/donde-tirar-imanes/", "https://reducereutilizarecicla.org/donde-tirar-fluorescentes/", "https://reducereutilizarecicla.org/donde-tirar-un-microondas/", "https://reducereutilizarecicla.org/reciclar-toallas/", "https://reducereutilizarecicla.org/reciclar-vaqueros/","https://reducereutilizarecicla.org/como-se-recicla-la-tela/", "https://reducereutilizarecicla.org/contenedor-rojo-ropa/", "https://reducereutilizarecicla.org/reciclar-chanclas/","https://reducereutilizarecicla.org/reciclar-banadores/","https://reducereutilizarecicla.org/asi-funciona-el-reciclaje-de-cremalleras/","https://reducereutilizarecicla.org/donde-tirar-zapatos/","https://reducereutilizarecicla.org/como-reciclar-una-camisa/","https://reducereutilizarecicla.org/donde-tirar-un-mantel-de-tela-sucio/","https://reducereutilizarecicla.org/contenedores-de-ropa/","https://reducereutilizarecicla.org/que-cosas-pueden-ser-recicladas/","https://reducereutilizarecicla.org/los-textiles-se-vuelven-ecologicos/","https://reducereutilizarecicla.org/donde-tirar-ropa-vieja/","https://espanol.epa.gov/espanol/terminos-0-9","https://espanol.epa.gov/espanol/terminos","https://espanol.epa.gov/espanol/terminos-b","https://espanol.epa.gov/espanol/terminos-c","https://espanol.epa.gov/espanol/terminos-d","https://espanol.epa.gov/espanol/terminos-e","https://espanol.epa.gov/espanol/terminos-f","https://espanol.epa.gov/espanol/terminos-g","https://espanol.epa.gov/espanol/terminos-h","https://espanol.epa.gov/espanol/terminos-i","https://espanol.epa.gov/espanol/terminos-j","https://espanol.epa.gov/espanol/terminos-l","https://espanol.epa.gov/espanol/terminos-m","https://espanol.epa.gov/espanol/terminos-n","https://espanol.epa.gov/espanol/terminos-o","https://espanol.epa.gov/espanol/terminos-p","https://espanol.epa.gov/espanol/terminos-q","https://espanol.epa.gov/espanol/terminos-r","https://espanol.epa.gov/espanol/terminos-s","https://espanol.epa.gov/espanol/terminos-t","https://espanol.epa.gov/espanol/terminos-u","https://espanol.epa.gov/espanol/terminos-v","https://espanol.epa.gov/espanol/terminos-w-x-y-z#W", "https://espanol.epa.gov/espanol/la-importancia-de-la-educacion-ambiental","https://espanol.epa.gov/espanol/consejo-del-dia-que-puede-hacer-para-reciclar-por-estacion","https://espanol.epa.gov/espanol/lo-que-puede-hacer-usted-acerca-de-la-contaminacion-por-basura-0","https://espanol.epa.gov/espanol/diez-maneras-de-eliminar-el-embalaje-y-las-envolturas-de-su-vida","https://blog.cerdanyaecoresort.com/sostenibilidad-ambiental-que-es-y-como-mejorarla-en-casa/","https://www.imh.eus/es/imh/comunicacion/docu-libre/reduccion-residuos","https://archivo-es.greenpeace.org/espana/Global/espana/report/contaminacion/Guia%20Transform-accion%20residuos.pdf","https://elpais.com/escaparate/2023-01-10/11-productos-sostenibles-de-uso-cotidiano-para-reducir-el-consumo-de-plastico-y-generar-menos-residuos.html", "https://elpais.com/escaparate/2023-01-10/11-productos-sostenibles-de-uso-cotidiano-para-reducir-el-consumo-de-plastico-y-generar-menos-residuos.html#", "https://www.iberdrola.com/sostenibilidad/productos-ecologicos", "https://www.retema.es/agenda", "https://www.iberdrola.com/sostenibilidad/reciclaje-para-ninos","https://www.miteco.gob.es/es/ceneam/recursos/pag-web/programas-planes/voluntariado-ong-internacionales.html", "https://www.iberdrola.com/compromiso-social/voluntariado-corporativo", "https://reducereutilizarecicla.org/reciclos-ecoembes/","https://reducereutilizarecicla.org/goma-eva-es-reciclable/", "https://reducereutilizarecicla.org/se-puede-generar-energia-en-los-vertederos/", "https://reducereutilizarecicla.org/tirar-la-basura-sin-bolsas/","https://reducereutilizarecicla.org/por-que-es-importante-saber-como-reutilizar-camisetas/","https://reducereutilizarecicla.org/reutilizar-pantalones/","https://reducereutilizarecicla.org/poliester-reciclado/","https://reducereutilizarecicla.org/ropa-con-materiales-reciclados/", "https://reducereutilizarecicla.org/contenedores-caseros-para-reciclar/","https://www.miteco.gob.es/es/calidad-y-evaluacion-ambiental/temas/prevencion-y-gestion-residuos/flujos/domesticos/gestion/sistema-recogida/puntos-limpios.html","https://punto-limpio.info/","https://reducereutilizarecicla.org/ecopuntos-que-son-y-donde-estan/"])
|
59 |
data=loader.load()
|
60 |
# split documents
|
@@ -152,10 +170,26 @@ chatbot_gradio_app = gr.ChatInterface(
|
|
152 |
title=custom_title
|
153 |
)
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
# Combine both interfaces into a single app
|
156 |
app = gr.TabbedInterface(
|
157 |
-
[image_gradio_app, chatbot_gradio_app],
|
158 |
-
tab_names=["Green Greta Image Classification","Green Greta Chat"],
|
159 |
theme=theme
|
160 |
)
|
161 |
|
|
|
3 |
import torch
|
4 |
import theme
|
5 |
|
6 |
+
from huggingface_hub import from_pretrained_keras
|
7 |
+
from tensorflow.keras.applications import EfficientNetB0
|
8 |
+
|
9 |
+
import tensorflow as tf
|
10 |
+
from tensorflow import keras
|
11 |
+
from PIL import Image
|
12 |
+
|
13 |
theme = theme.Theme()
|
14 |
|
15 |
import os
|
|
|
43 |
import shutil
|
44 |
|
45 |
|
|
|
46 |
custom_title = "<span style='color: rgb(243, 239, 224);'>Green Greta</span>"
|
47 |
|
48 |
|
49 |
# Cell 1: Image Classification Model
|
50 |
+
model1 = from_pretrained_keras("rocioadlc/efficientnetB0_trash")
|
51 |
+
|
52 |
+
# Define class labels
|
53 |
+
class_labels = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
|
54 |
+
|
55 |
+
# Function to predict image label and score
|
56 |
+
def predict_image(input):
|
57 |
+
# Resize the image to the size expected by the model and convert to numpy array
|
58 |
+
image_array = tf.keras.preprocessing.image.img_to_array(input.resize((244, 224))) # Cambiar el orden de las dimensiones
|
59 |
+
# Normalize the image
|
60 |
+
image_array = tf.keras.applications.efficientnet.preprocess_input(image_array)
|
61 |
+
# Expand the dimensions to create a batch
|
62 |
+
image_array = tf.expand_dims(image_array, 0)
|
63 |
+
# Predict using the model
|
64 |
+
predictions = model1.predict(image_array)
|
65 |
+
class_labels = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
|
66 |
+
category_scores = {}
|
67 |
+
for i, class_label in enumerate(class_labels):
|
68 |
+
category_scores[class_label] = predictions[0][i].item()
|
69 |
+
|
70 |
+
return category_scores
|
71 |
+
|
72 |
|
|
|
|
|
|
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
# Cell 2: ChatBot Model
|
76 |
loader = WebBaseLoader(["https://www.epa.gov/recycle/frequent-questions-recycling", "https://www.whitehorsedc.gov.uk/vale-of-white-horse-district-council/recycling-rubbish-and-waste/lets-get-real-about-recycling/", "https://www.teimas.com/blog/13-preguntas-y-respuestas-sobre-la-ley-de-residuos-07-2022", "https://www.molok.com/es/blog/gestion-de-residuos-solidos-urbanos-rsu-10-dudas-comunes", "https://espanol.epa.gov/espanol/el-reciclaje#valelapena","https://espanol.epa.gov/espanol/preguntas-frecuentes-sobre-reciclado-de-plastico-y-elaboracion-de-abono-vegetal","https://espanol.epa.gov/espanol/consejo-del-dia-como-reciclo-mis","https://espanol.epa.gov/espanol/recursos-para-reciclar-dispositivos-electronicos","https://www.epa.gov/recycle/electronics-donation-and-recycling","https://reducereutilizarecicla.org/que-es-el-reciclaje/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/", "https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-amarillo/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-azul/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-verde/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-marron-organico/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/contenedor-gris-restos/","https://reducereutilizarecicla.org/contenedores-de-reciclaje/punto-limpio/", "https://reducereutilizarecicla.org/donde-tirar-auriculares/","https://reducereutilizarecicla.org/donde-tirar-sartenes/","https://reducereutilizarecicla.org/donde-tirar-aceite-usado/","https://reducereutilizarecicla.org/como-se-reciclan-los-envases-tipo-brik/","https://reducereutilizarecicla.org/los-envases-del-verano/", "https://reducereutilizarecicla.org/donde-tirar-radiografias/","https://reducereutilizarecicla.org/envases-ecologicos/","https://reducereutilizarecicla.org/donde-tirar-los-restos-de-pintura/","https://reducereutilizarecicla.org/valorizacion-de-residuos/","https://reducereutilizarecicla.org/como-reciclar-pilas/","https://reducereutilizarecicla.org/como-reciclar-capsulas-de-cafe/","https://reducereutilizarecicla.org/reciclando-cd/", "https://reducereutilizarecicla.org/donde-tirar-neumaticos/","https://reducereutilizarecicla.org/como-reciclar-una-canasta-de-mimbre/","https://reducereutilizarecicla.org/como-funciona-el-contenedor-amarillo/", "https://reducereutilizarecicla.org/donde-se-tiran-los-vapers/","https://reducereutilizarecicla.org/cuanto-tarda-una-bolsa-biodegradable-en-degradarse/", "https://reducereutilizarecicla.org/donde-se-reciclan-los-juguetes/","https://reducereutilizarecicla.org/objetos-que-se-pueden-reutilizar/","https://reducereutilizarecicla.org/la-parafina-se-puede-reutilizar/","https://reducereutilizarecicla.org/planta-de-reciclaje-de-papel/", "https://reducereutilizarecicla.org/como-saber-si-un-envase-es-reciclable/", "https://reducereutilizarecicla.org/reutilizar-vasos-de-vela/", "https://reducereutilizarecicla.org/bolsas-frio-calor/", "https://reducereutilizarecicla.org/reciclar-y-reutilizar-materiales-de-construccion/", "https://reducereutilizarecicla.org/que-es-exactamente-el-pet/", "https://reducereutilizarecicla.org/tipos-de-reciclaje/", "https://reducereutilizarecicla.org/que-hacer-con-palets-reciclados/", "https://reducereutilizarecicla.org/vertederos-controlados/", "https://reducereutilizarecicla.org/donde-tirar-escombros/","https://reducereutilizarecicla.org/como-reciclar-los-residuos-de-ps-poliestireno/","https://reducereutilizarecicla.org/tirar-la-basura-sin-bolsas/","https://reducereutilizarecicla.org/tirar-el-palo-de-la-fregona/","https://reducereutilizarecicla.org/la-mejor-manera-de-reciclar-una-pala-de-padel/", "https://reducereutilizarecicla.org/sabes-donde-tirar-las-llantas-viejas-de-un-coche/","https://reducereutilizarecicla.org/sabes-donde-tirar-el-arbol-de-navidad/","https://reducereutilizarecicla.org/clavos-tornillos-herramientas-donde-tirar-hierro/","https://reducereutilizarecicla.org/donde-tirar-un-secador-de-pelo-contenedor-o-punto-limpio/","https://reducereutilizarecicla.org/donde-tirar-electrodomesticos/","https://reducereutilizarecicla.org/donde-puedo-tirar-ramas-de-arboles/", "https://reducereutilizarecicla.org/donde-tirar-escombros/","https://reducereutilizarecicla.org/donde-se-tira-el-muerdago-quemado/","https://reducereutilizarecicla.org/sandalias-caucho-reciclado-neumaticos/","https://reducereutilizarecicla.org/ideas-para-reciclar-aspas-de-ventilador-de-techo/","https://reducereutilizarecicla.org/reciclar-sacos-dormir/","https://reducereutilizarecicla.org/reciclar-sillas-playa/","https://reducereutilizarecicla.org/donde-tirar-antipolillas/","https://reducereutilizarecicla.org/que-hacer-con-los-juguetes-viejos/","https://reducereutilizarecicla.org/como-utilizar-las-mascarillas-y-el-gel-hidroalcoholico-en-la-playa/","https://reducereutilizarecicla.org/ideas-para-reciclar-un-ventilador-de-pie/","https://reducereutilizarecicla.org/donde-tirar-gasoil/","https://reducereutilizarecicla.org/donde-puedo-tirar-basura-electronica/","https://reducereutilizarecicla.org/donde-tirar-agujas/", "https://reducereutilizarecicla.org/donde-tirar-residuos-peligrosos/", "https://reducereutilizarecicla.org/donde-tirar-los-cables/", "https://reducereutilizarecicla.org/donde-tirar-bicicletas/", "https://reducereutilizarecicla.org/donde-tirar-maletas/", "https://reducereutilizarecicla.org/como-reciclar-una-pantalla/", "https://reducereutilizarecicla.org/metales-reciclables/","https://reducereutilizarecicla.org/donde-tirar-caja-de-helado/", "https://reducereutilizarecicla.org/como-reciclar-perchas-de-plastico/","https://reducereutilizarecicla.org/donde-tirar-un-jarron-de-ceramica/","https://reducereutilizarecicla.org/donde-tirar-sanitarios/", "https://reducereutilizarecicla.org/reciclar-bombonas-de-camping-gas/", "https://reducereutilizarecicla.org/donde-tirar-aceite-usado-de-motor/", "https://reducereutilizarecicla.org/como-reciclar-rotuladores-subrayadores-y-boligrafos/", "https://reducereutilizarecicla.org/donde-tirar-un-ordenador/", "https://reducereutilizarecicla.org/donde-tirar-un-termometro-de-mercurio/", "https://reducereutilizarecicla.org/tirar-nevera-vieja/","https://reducereutilizarecicla.org/que-cosas-pueden-ser-recicladas/","https://reducereutilizarecicla.org/donde-tirar-los-pintaunas/","https://reducereutilizarecicla.org/donde-tirar-bombona-de-helio/", "https://reducereutilizarecicla.org/donde-tirar-alfombras/", "https://reducereutilizarecicla.org/donde-tirar-impresoras-y-sus-cartuchos-o-toner/", "https://reducereutilizarecicla.org/donde-tirar-aguarras/","https://reducereutilizarecicla.org/donde-tirar-discos-duros/","https://reducereutilizarecicla.org/donde-tirar-azulejos/","https://reducereutilizarecicla.org/donde-tirar-diapositivas/","https://reducereutilizarecicla.org/donde-tirar-jeringuillas-usadas/","https://reducereutilizarecicla.org/donde-tirar-cintas-vhs/","https://reducereutilizarecicla.org/donde-tirar-gomaespuma/", "https://reducereutilizarecicla.org/donde-tirar-los-botes-de-pintura/", "https://reducereutilizarecicla.org/donde-se-recicla-la-madera/", "https://reducereutilizarecicla.org/donde-tirar-discos-de-vinilo/", "https://reducereutilizarecicla.org/donde-tirar-imanes/", "https://reducereutilizarecicla.org/donde-tirar-fluorescentes/", "https://reducereutilizarecicla.org/donde-tirar-un-microondas/", "https://reducereutilizarecicla.org/reciclar-toallas/", "https://reducereutilizarecicla.org/reciclar-vaqueros/","https://reducereutilizarecicla.org/como-se-recicla-la-tela/", "https://reducereutilizarecicla.org/contenedor-rojo-ropa/", "https://reducereutilizarecicla.org/reciclar-chanclas/","https://reducereutilizarecicla.org/reciclar-banadores/","https://reducereutilizarecicla.org/asi-funciona-el-reciclaje-de-cremalleras/","https://reducereutilizarecicla.org/donde-tirar-zapatos/","https://reducereutilizarecicla.org/como-reciclar-una-camisa/","https://reducereutilizarecicla.org/donde-tirar-un-mantel-de-tela-sucio/","https://reducereutilizarecicla.org/contenedores-de-ropa/","https://reducereutilizarecicla.org/que-cosas-pueden-ser-recicladas/","https://reducereutilizarecicla.org/los-textiles-se-vuelven-ecologicos/","https://reducereutilizarecicla.org/donde-tirar-ropa-vieja/","https://espanol.epa.gov/espanol/terminos-0-9","https://espanol.epa.gov/espanol/terminos","https://espanol.epa.gov/espanol/terminos-b","https://espanol.epa.gov/espanol/terminos-c","https://espanol.epa.gov/espanol/terminos-d","https://espanol.epa.gov/espanol/terminos-e","https://espanol.epa.gov/espanol/terminos-f","https://espanol.epa.gov/espanol/terminos-g","https://espanol.epa.gov/espanol/terminos-h","https://espanol.epa.gov/espanol/terminos-i","https://espanol.epa.gov/espanol/terminos-j","https://espanol.epa.gov/espanol/terminos-l","https://espanol.epa.gov/espanol/terminos-m","https://espanol.epa.gov/espanol/terminos-n","https://espanol.epa.gov/espanol/terminos-o","https://espanol.epa.gov/espanol/terminos-p","https://espanol.epa.gov/espanol/terminos-q","https://espanol.epa.gov/espanol/terminos-r","https://espanol.epa.gov/espanol/terminos-s","https://espanol.epa.gov/espanol/terminos-t","https://espanol.epa.gov/espanol/terminos-u","https://espanol.epa.gov/espanol/terminos-v","https://espanol.epa.gov/espanol/terminos-w-x-y-z#W", "https://espanol.epa.gov/espanol/la-importancia-de-la-educacion-ambiental","https://espanol.epa.gov/espanol/consejo-del-dia-que-puede-hacer-para-reciclar-por-estacion","https://espanol.epa.gov/espanol/lo-que-puede-hacer-usted-acerca-de-la-contaminacion-por-basura-0","https://espanol.epa.gov/espanol/diez-maneras-de-eliminar-el-embalaje-y-las-envolturas-de-su-vida","https://blog.cerdanyaecoresort.com/sostenibilidad-ambiental-que-es-y-como-mejorarla-en-casa/","https://www.imh.eus/es/imh/comunicacion/docu-libre/reduccion-residuos","https://archivo-es.greenpeace.org/espana/Global/espana/report/contaminacion/Guia%20Transform-accion%20residuos.pdf","https://elpais.com/escaparate/2023-01-10/11-productos-sostenibles-de-uso-cotidiano-para-reducir-el-consumo-de-plastico-y-generar-menos-residuos.html", "https://elpais.com/escaparate/2023-01-10/11-productos-sostenibles-de-uso-cotidiano-para-reducir-el-consumo-de-plastico-y-generar-menos-residuos.html#", "https://www.iberdrola.com/sostenibilidad/productos-ecologicos", "https://www.retema.es/agenda", "https://www.iberdrola.com/sostenibilidad/reciclaje-para-ninos","https://www.miteco.gob.es/es/ceneam/recursos/pag-web/programas-planes/voluntariado-ong-internacionales.html", "https://www.iberdrola.com/compromiso-social/voluntariado-corporativo", "https://reducereutilizarecicla.org/reciclos-ecoembes/","https://reducereutilizarecicla.org/goma-eva-es-reciclable/", "https://reducereutilizarecicla.org/se-puede-generar-energia-en-los-vertederos/", "https://reducereutilizarecicla.org/tirar-la-basura-sin-bolsas/","https://reducereutilizarecicla.org/por-que-es-importante-saber-como-reutilizar-camisetas/","https://reducereutilizarecicla.org/reutilizar-pantalones/","https://reducereutilizarecicla.org/poliester-reciclado/","https://reducereutilizarecicla.org/ropa-con-materiales-reciclados/", "https://reducereutilizarecicla.org/contenedores-caseros-para-reciclar/","https://www.miteco.gob.es/es/calidad-y-evaluacion-ambiental/temas/prevencion-y-gestion-residuos/flujos/domesticos/gestion/sistema-recogida/puntos-limpios.html","https://punto-limpio.info/","https://reducereutilizarecicla.org/ecopuntos-que-son-y-donde-estan/"])
|
77 |
data=loader.load()
|
78 |
# split documents
|
|
|
170 |
title=custom_title
|
171 |
)
|
172 |
|
173 |
+
# Banner tab
|
174 |
+
banner_tab_content = """
|
175 |
+
<div style="background-color: #d3e3c3; text-align: center; padding: 20px; display: flex; flex-direction: column; align-items: center;">
|
176 |
+
<img src="https://huggingface.co/spaces/rocioadlc/test_4/resolve/main/front_4.jpg" alt="Banner Image" style="width: 50%; max-width: 500px; margin: 0 auto;">
|
177 |
+
<h1 style="font-size: 24px; color: "#92b96a"; margin-top: 20px;">¡Bienvenido a nuestro clasificador de imágenes y chatbot para un reciclaje más inteligente!♻️</h1>
|
178 |
+
<p style="font-size: 16px; color: "#92b96a"; text-align: justify;">¿Alguna vez te has preguntado si puedes reciclar un objeto en particular? ¿O te has sentido abrumado por la cantidad de residuos que generas y no sabes cómo manejarlos de manera más sostenible? ¡Estás en el lugar correcto!</p>
|
179 |
+
<p style="font-size: 16px; color: "#92b96a"; text-align: justify;">Nuestra plataforma combina la potencia de la inteligencia artificial con la comodidad de un chatbot para brindarte respuestas rápidas y precisas sobre qué objetos son reciclables y cómo hacerlo de la manera más eficiente.</p>
|
180 |
+
<p style="font-size: 16px; text-align:center;"><strong><span style="color: "#92b96a";">¿Cómo usarlo?</span></strong>
|
181 |
+
<ul style="list-style-type: disc; text-align: justify; margin-top: 20px; padding-left: 20px;">
|
182 |
+
<li style="font-size: 16px; color: "#92b96a";"><strong><span style="color: "#92b96a";">Green Greta Image Classification:</span></strong> Ve a la pestaña Greta Image Classification y simplemente carga una foto del objeto que quieras reciclar, y nuestro modelo de identificará de qué se trata🕵️♂️ para que puedas desecharlo adecuadamente.</li>
|
183 |
+
<li style="font-size: 16px; color: "#92b96a";"><strong><span style="color: "#92b96a";">Green Greta Chat:</span></strong> ¿Tienes preguntas sobre reciclaje, materiales específicos o prácticas sostenibles? ¡Pregunta a nuestro chatbot en la pestaña Green Greta Chat!📝 Está aquí para responder todas tus preguntas y ayudarte a tomar decisiones más informadas sobre tu reciclaje.</li>
|
184 |
+
</ul>
|
185 |
+
</div>
|
186 |
+
"""
|
187 |
+
banner_tab = gr.Markdown(banner_tab_content)
|
188 |
+
|
189 |
# Combine both interfaces into a single app
|
190 |
app = gr.TabbedInterface(
|
191 |
+
[banner_tab, image_gradio_app, chatbot_gradio_app],
|
192 |
+
tab_names=["Welcome to Green Greta", "Green Greta Image Classification", "Green Greta Chat"],
|
193 |
theme=theme
|
194 |
)
|
195 |
|