Download ml/qa_topics.py from paralaif/tiny-scene-three: direct link, hf CLI and curl.
- Browser
- Download file 20.1 kB
-
https://huggingface.co/paralaif/tiny-scene-three/resolve/main/ml/qa_topics.py
- Command line
-
hf download hf://paralaif/tiny-scene-three/ml/qa_topics.py
-
curl -L -o qa_topics.py https://huggingface.co/paralaif/tiny-scene-three/resolve/main/ml/qa_topics.py
20.1 kB
| """three.js question topics. The model only predicts `lang` and `topic`; the app shows the stored answer.""" | |
| # key: (english terms, spanish terms, extra english questions, extra spanish questions, answer en, answer es) | |
| TOPICS = { | |
| "threejs": ( | |
| "three.js|threejs|three js|the three.js library", | |
| "three.js|threejs|three js|la librería three.js", | |
| "what is this library|what is webgl|why use three.js", | |
| "qué es esta librería|qué es webgl|por qué usar three.js", | |
| "three.js is a JavaScript library that draws 3D graphics in the browser on top of WebGL. You describe a scene with objects, lights and a camera, and a renderer draws it to a canvas every frame.", | |
| "three.js es una librería de JavaScript que dibuja gráficos 3D en el navegador sobre WebGL. Describes una escena con objetos, luces y una cámara, y un renderer la dibuja en un canvas en cada fotograma.", | |
| ), | |
| "scene": ( | |
| "a scene|the scene|scenes|the scene graph", | |
| "una escena|la escena|las escenas|el grafo de escena", | |
| "how do i add objects to the scene|what is scene.add", | |
| "cómo añado objetos a la escena|qué es scene.add", | |
| "A THREE.Scene is the root container. Everything you want drawn (meshes, lights, groups) is added with scene.add(object), and removed with scene.remove(object).", | |
| "THREE.Scene es el contenedor raíz. Todo lo que quieras dibujar (mallas, luces, grupos) se añade con scene.add(objeto) y se quita con scene.remove(objeto).", | |
| ), | |
| "camera": ( | |
| "a camera|the camera|cameras|a perspective camera|the field of view", | |
| "una cámara|la cámara|las cámaras|una cámara en perspectiva|el campo de visión", | |
| "how do i move the camera|what is fov|perspective or orthographic camera", | |
| "cómo muevo la cámara|qué es el fov|cámara en perspectiva u ortográfica", | |
| "The camera decides what is visible. PerspectiveCamera(fov, aspect, near, far) imitates a real lens; OrthographicCamera has no perspective. Move it with camera.position.set(x, y, z) and aim it with camera.lookAt(target).", | |
| "La cámara decide qué se ve. PerspectiveCamera(fov, aspect, near, far) imita una lente real; OrthographicCamera no tiene perspectiva. Se mueve con camera.position.set(x, y, z) y se apunta con camera.lookAt(objetivo).", | |
| ), | |
| "renderer": ( | |
| "a renderer|the renderer|the webgl renderer|rendering", | |
| "un renderer|el renderer|el renderizador|el renderizado", | |
| "how do i render the scene|what is the render loop|what is setAnimationLoop", | |
| "cómo renderizo la escena|qué es el bucle de render|qué es setAnimationLoop", | |
| "WebGLRenderer draws a scene from a camera into a canvas: renderer.render(scene, camera). Call it every frame with renderer.setAnimationLoop(fn), and set the size with renderer.setSize(width, height).", | |
| "WebGLRenderer dibuja una escena vista desde una cámara en un canvas: renderer.render(scene, camera). Se llama en cada fotograma con renderer.setAnimationLoop(fn), y el tamaño se fija con renderer.setSize(ancho, alto).", | |
| ), | |
| "mesh": ( | |
| "a mesh|the mesh|meshes|a 3d object", | |
| "una malla|la malla|las mallas|un mesh|un objeto 3d", | |
| "how do i create a cube|how do i make a sphere|how do i create an object", | |
| "cómo creo un cubo|cómo hago una esfera|cómo creo un objeto", | |
| "A Mesh is a visible object: geometry (the shape) plus material (the look). Example: new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshStandardMaterial({ color: 'red' })).", | |
| "Un Mesh es un objeto visible: geometría (la forma) más material (el aspecto). Ejemplo: new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshStandardMaterial({ color: 'red' })).", | |
| ), | |
| "geometry": ( | |
| "a geometry|the geometry|geometries|buffer geometry|vertices", | |
| "una geometría|la geometría|las geometrías|los vértices", | |
| "which shapes are available|what primitives exist", | |
| "qué formas hay disponibles|qué primitivas existen", | |
| "A geometry holds the vertices of a shape. Built-in ones include BoxGeometry, SphereGeometry, CylinderGeometry, ConeGeometry, TorusGeometry and PlaneGeometry. Every object in this app is assembled from those primitives.", | |
| "Una geometría guarda los vértices de una forma. Las incluidas son BoxGeometry, SphereGeometry, CylinderGeometry, ConeGeometry, TorusGeometry y PlaneGeometry, entre otras. Todos los objetos de esta app se arman con esas primitivas.", | |
| ), | |
| "material": ( | |
| "a material|the material|materials|mesh standard material", | |
| "un material|el material|los materiales", | |
| "how do i make something shiny|what is roughness|what is metalness|how do i make it transparent", | |
| "cómo hago algo brillante|qué es roughness|qué es metalness|cómo lo hago transparente", | |
| "A material defines how a surface looks. MeshBasicMaterial ignores light, MeshStandardMaterial reacts to it with roughness and metalness, and MeshToonMaterial gives a cartoon look. Set transparent: true and opacity for see-through surfaces.", | |
| "Un material define cómo se ve una superficie. MeshBasicMaterial ignora la luz, MeshStandardMaterial reacciona a ella con roughness y metalness, y MeshToonMaterial da un aspecto de dibujo. Usa transparent: true y opacity para superficies translúcidas.", | |
| ), | |
| "light": ( | |
| "a light|the light|lights|lighting|a directional light|ambient light", | |
| "una luz|la luz|las luces|la iluminación|una luz direccional|la luz ambiental", | |
| "why is my scene black|why is everything dark|how do i light the scene", | |
| "por qué mi escena está negra|por qué todo se ve oscuro|cómo ilumino la escena", | |
| "Lights make standard materials visible. AmbientLight and HemisphereLight fill the whole scene, DirectionalLight acts like the sun, PointLight like a bulb and SpotLight like a torch. A black scene usually means there is no light.", | |
| "Las luces hacen visibles los materiales estándar. AmbientLight y HemisphereLight rellenan toda la escena, DirectionalLight actúa como el sol, PointLight como una bombilla y SpotLight como una linterna. Una escena negra casi siempre significa que falta una luz.", | |
| ), | |
| "shadow": ( | |
| "a shadow|shadows|the shadow map|cast shadow", | |
| "una sombra|las sombras|el mapa de sombras", | |
| "why are there no shadows|how do i enable shadows", | |
| "por qué no hay sombras|cómo activo las sombras", | |
| "Shadows need three switches: renderer.shadowMap.enabled = true, light.castShadow = true, and on each mesh castShadow and/or receiveShadow = true. Tune light.shadow.mapSize and the shadow camera bounds for quality.", | |
| "Las sombras necesitan tres interruptores: renderer.shadowMap.enabled = true, light.castShadow = true y, en cada malla, castShadow y/o receiveShadow = true. La calidad se ajusta con light.shadow.mapSize y los límites de la cámara de sombra.", | |
| ), | |
| "animation": ( | |
| "an animation|animation|animations|the animation loop|keyframes", | |
| "una animación|la animación|las animaciones|el bucle de animación|los keyframes", | |
| "how do i animate an object|how do i move an object|how do i rotate something over time", | |
| "cómo animo un objeto|cómo muevo un objeto|cómo roto algo con el tiempo", | |
| "The simplest animation changes position, rotation or scale every frame inside the render loop, using elapsed time. For keyframes use AnimationMixer with AnimationClip. This app animates everything procedurally from the time value.", | |
| "La animación más simple cambia posición, rotación o escala en cada fotograma dentro del bucle de render, usando el tiempo transcurrido. Para keyframes se usa AnimationMixer con AnimationClip. Esta app anima todo de forma procedural a partir del tiempo.", | |
| ), | |
| "texture": ( | |
| "a texture|the texture|textures|an image on an object", | |
| "una textura|la textura|las texturas|una imagen en un objeto", | |
| "how do i load an image|how do i put a picture on a cube", | |
| "cómo cargo una imagen|cómo pongo una foto en un cubo", | |
| "A texture is an image mapped onto a surface. Load it with new THREE.TextureLoader().load(url) and assign it to material.map. CanvasTexture turns a 2D canvas drawing into a texture.", | |
| "Una textura es una imagen aplicada a una superficie. Se carga con new THREE.TextureLoader().load(url) y se asigna a material.map. CanvasTexture convierte un dibujo de canvas 2D en textura.", | |
| ), | |
| "gltf": ( | |
| "gltf|a gltf file|glb|a 3d model|the gltf exporter", | |
| "gltf|un archivo gltf|glb|un modelo 3d|el exportador gltf", | |
| "how do i load a model|how do i export the scene|how do i import a model|can i open this in blender", | |
| "cómo cargo un modelo|cómo exporto la escena|cómo importo un modelo|puedo abrir esto en blender", | |
| "glTF (.gltf or .glb) is the standard 3D format for the web. Load models with GLTFLoader and save scenes with GLTFExporter. The export button here writes a .glb you can open in Blender.", | |
| "glTF (.gltf o .glb) es el formato 3D estándar para la web. Los modelos se cargan con GLTFLoader y las escenas se guardan con GLTFExporter. El botón de exportar de esta app genera un .glb que puedes abrir en Blender.", | |
| ), | |
| "controls": ( | |
| "orbit controls|the controls|camera controls|mouse controls", | |
| "orbit controls|los controles|los controles de cámara|los controles del ratón", | |
| "how do i rotate the view with the mouse|how do i let the user move the camera", | |
| "cómo giro la vista con el ratón|cómo dejo que el usuario mueva la cámara", | |
| "OrbitControls lets the user orbit, zoom and pan with the mouse or touch: new OrbitControls(camera, renderer.domElement), then controls.update() every frame. Here you can drag the view at any time.", | |
| "OrbitControls permite orbitar, hacer zoom y desplazar con el ratón o el dedo: new OrbitControls(camera, renderer.domElement) y luego controls.update() en cada fotograma. Aquí puedes arrastrar la vista en cualquier momento.", | |
| ), | |
| "raycaster": ( | |
| "a raycaster|the raycaster|raycasting|picking", | |
| "un raycaster|el raycaster|raycasting", | |
| "how do i click on an object|how do i detect clicks|how do i select an object with the mouse", | |
| "cómo hago clic en un objeto|cómo detecto clics|cómo selecciono un objeto con el ratón", | |
| "A Raycaster shoots a ray from the camera through the mouse position and returns the objects it hits: raycaster.setFromCamera(pointer, camera) followed by raycaster.intersectObjects(scene.children).", | |
| "Un Raycaster lanza un rayo desde la cámara a través de la posición del ratón y devuelve los objetos que toca: raycaster.setFromCamera(pointer, camera) seguido de raycaster.intersectObjects(scene.children).", | |
| ), | |
| "fog": ( | |
| "scene fog|the fog object|fog in three.js|exponential fog", | |
| "la niebla de la escena|el objeto fog|la niebla en three.js|la niebla exponencial", | |
| "how does fog work|how do i fade distant objects", | |
| "cómo funciona la niebla|cómo desvanezco los objetos lejanos", | |
| "Fog fades distant objects into a colour: scene.fog = new THREE.Fog(color, near, far) or new THREE.FogExp2(color, density). Match the fog colour to the background so the horizon blends.", | |
| "La niebla desvanece los objetos lejanos hacia un color: scene.fog = new THREE.Fog(color, near, far) o new THREE.FogExp2(color, densidad). Usa el mismo color que el fondo para que el horizonte se funda.", | |
| ), | |
| "performance": ( | |
| "performance|the frame rate|fps|optimization|draw calls", | |
| "el rendimiento|los fps|la optimización|las draw calls", | |
| "why is it slow|how do i make it faster|how do i optimize my scene", | |
| "por qué va lento|cómo lo hago más rápido|cómo optimizo mi escena", | |
| "To keep the frame rate high: reuse geometries and materials, merge static meshes or use InstancedMesh, limit shadow-casting lights, cap the pixel ratio at 2, and dispose of what you remove.", | |
| "Para mantener los fps altos: reutiliza geometrías y materiales, fusiona mallas estáticas o usa InstancedMesh, limita las luces con sombra, limita el pixel ratio a 2 y libera con dispose lo que quites.", | |
| ), | |
| "group": ( | |
| "a group|groups|the hierarchy|parent and child objects|object3d", | |
| "un grupo|los grupos|la jerarquía|objetos padre e hijo|object3d", | |
| "how do i attach an object to another|how do i move several objects together", | |
| "cómo uno un objeto a otro|cómo muevo varios objetos juntos", | |
| "A Group (or any Object3D) can hold children with parent.add(child). Children inherit the parent's position, rotation and scale, which is how a leg swings from a hip or a rider follows a horse.", | |
| "Un Group (o cualquier Object3D) puede tener hijos con padre.add(hijo). Los hijos heredan posición, rotación y escala del padre; así una pata gira desde la cadera o un jinete sigue a su caballo.", | |
| ), | |
| "color": ( | |
| "colors in three.js|the color class|three color|hex colors", | |
| "los colores en three.js|la clase color|three color|los colores hexadecimales", | |
| "how do i change the color of a material|how do i set a color in code", | |
| "cómo cambio el color de un material|cómo pongo un color en código", | |
| "THREE.Color accepts hex numbers (0xff0000), CSS strings ('red', '#ff0000') or HSL via setHSL. Change a material at any time with material.color.set('blue').", | |
| "THREE.Color acepta números hexadecimales (0xff0000), cadenas CSS ('red', '#ff0000') o HSL con setHSL. Cambia un material en cualquier momento con material.color.set('blue').", | |
| ), | |
| "resize": ( | |
| "window resize|resizing|the aspect ratio|a responsive canvas", | |
| "el cambio de tamaño de ventana|la relación de aspecto|un canvas adaptable", | |
| "why is my scene stretched|how do i handle window resize|how do i make it fullscreen", | |
| "por qué mi escena se ve estirada|cómo manejo el cambio de tamaño|cómo lo pongo en pantalla completa", | |
| "On resize, update three things: camera.aspect = width / height, camera.updateProjectionMatrix(), and renderer.setSize(width, height). A stretched image means the aspect was not updated.", | |
| "Al cambiar el tamaño hay que actualizar tres cosas: camera.aspect = ancho / alto, camera.updateProjectionMatrix() y renderer.setSize(ancho, alto). Una imagen estirada indica que no se actualizó el aspecto.", | |
| ), | |
| "particles": ( | |
| "particles|a particle system|points|the points material", | |
| "las partículas|un sistema de partículas|points|el material de puntos", | |
| "how do i make rain|how do i make snow in code|how do i create stars", | |
| "cómo hago lluvia en código|cómo hago nieve en código|cómo creo estrellas", | |
| "Particles are a THREE.Points object: one BufferGeometry with many positions and a PointsMaterial. Move the positions every frame and set needsUpdate. The rain, snow and stars here are built that way.", | |
| "Las partículas son un objeto THREE.Points: una BufferGeometry con muchas posiciones y un PointsMaterial. Se mueven las posiciones en cada fotograma y se marca needsUpdate. La lluvia, la nieve y las estrellas de esta app están hechas así.", | |
| ), | |
| "music": ( | |
| "the music|the soundtrack|the sound|the audio", | |
| "la música|la banda sonora|el sonido|el audio", | |
| "how does the music work|how is the music made|can you make music|what music can you play|which music styles are there", | |
| "cómo funciona la música|cómo se hace la música|puedes hacer música|qué música puedes poner|qué estilos de música hay", | |
| "The music is generated live, not recorded. I pick a mood, a style and a tempo (from your words, or from the scene if you say nothing) and a small procedural band plays a chord progression, bass, drums and a melody with Tone.js. Dancing and jumping follow the beat. Try \"sad jazz music\", \"make the music faster\", \"no drums\" or \"stop the music\".", | |
| "La música se genera en vivo, no está grabada. Elijo un ánimo, un estilo y un tempo (de tus palabras, o de la escena si no dices nada) y una pequeña banda procedural toca acordes, bajo, batería y melodía con Tone.js. El baile y los saltos siguen el pulso. Prueba \"música de jazz triste\", \"haz la música más rápida\", \"sin batería\" o \"quita la música\".", | |
| ), | |
| "help": ( | |
| "this app|this tool|the commands", | |
| "esta app|esta herramienta|los comandos", | |
| "help|what can you do|how do i use this|what can i ask|how does this work|what can i type|give me examples", | |
| "ayuda|qué puedes hacer|cómo uso esto|qué puedo pedir|cómo funciona esto|qué puedo escribir|dame ejemplos", | |
| "Describe a scene and I build it: \"a red fox jumping over a car in the desert at sunset\". Then edit it: \"make the fox blue\", \"add a tree\", \"remove the car\", \"make it rain\", \"zoom out\", \"play calm music\". You can also ask about three.js.", | |
| "Describe una escena y la construyo: \"un zorro rojo saltando sobre un coche en el desierto al atardecer\". Luego edítala: \"haz el zorro azul\", \"añade un árbol\", \"quita el coche\", \"que llueva\", \"aleja la cámara\", \"pon música tranquila\". También puedes preguntar sobre three.js.", | |
| ), | |
| "objects": ( | |
| "the available objects|the object list|the characters|the animals", | |
| "los objetos disponibles|la lista de objetos|los personajes|los animales", | |
| "what objects do you know|which objects can i use|what can you draw|list the objects|what animals are there", | |
| "qué objetos conoces|qué objetos puedo usar|qué puedes dibujar|lista los objetos|qué animales hay", | |
| "@objects", | |
| "@objects", | |
| ), | |
| "actions": ( | |
| "the available actions|the action list|the movements", | |
| "las acciones disponibles|la lista de acciones|los movimientos", | |
| "what actions do you know|which actions can i use|what can the characters do|list the actions", | |
| "qué acciones conoces|qué acciones puedo usar|qué pueden hacer los personajes|lista las acciones", | |
| "@actions", | |
| "@actions", | |
| ), | |
| "about": ( | |
| "this model|the model|the neural network|the ai", | |
| "este modelo|el modelo|la red neuronal|la ia", | |
| "who are you|what are you|how do you work|are you an ai|how big is the model|how were you trained", | |
| "quién eres|qué eres|cómo funcionas|eres una ia|qué tan grande es el modelo|cómo te entrenaron", | |
| "I am a tiny Transformer trained from scratch on synthetic prompts. I do not generate geometry: I translate your sentence into a compact scene language, and procedural three.js code builds and animates the result. I run entirely in your browser.", | |
| "Soy un Transformer diminuto entrenado desde cero con frases sintéticas. No genero geometría: traduzco tu frase a un lenguaje de escena compacto, y código procedural de three.js construye y anima el resultado. Funciono por completo en tu navegador.", | |
| ), | |
| } | |
| Q_EN = [ | |
| "what is {t}", "what's {t}", "what are {t}", "how do i use {t}", "how do i create {t}", "how do i add {t}", | |
| "explain {t}", "tell me about {t}", "how does {t} work", "help with {t}", "what does {t} do", | |
| "how to set up {t}", "how can i use {t}", "can you explain {t}", "{t}", "i have a question about {t}", | |
| ] | |
| Q_ES = [ | |
| "qué es {t}", "qué son {t}", "cómo uso {t}", "cómo creo {t}", "cómo añado {t}", "explica {t}", | |
| "explícame {t}", "háblame de {t}", "cómo funciona {t}", "ayuda con {t}", "para qué sirve {t}", | |
| "cómo se usa {t}", "cómo configuro {t}", "puedes explicar {t}", "{t}", "tengo una pregunta sobre {t}", | |
| ] | |
| SUF_EN = ["", "", "", " in three.js", " in threejs", " with three.js"] | |
| SUF_ES = ["", "", "", " en three.js", " en threejs", " con three.js"] | |