Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- README.md +45 -12
- app.py +19 -0
- explain_utils.py +16 -0
- requirements.txt +3 -3
README.md
CHANGED
|
@@ -1,19 +1,52 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: 🚀
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
- streamlit
|
| 10 |
pinned: false
|
| 11 |
-
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: NASA Report Simplifier
|
| 3 |
emoji: 🚀
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.32.0
|
| 8 |
+
app_file: app.py
|
|
|
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# NASA Report Simplifier
|
| 14 |
|
| 15 |
+
Este Space convierte textos científicos complejos (como los de la NASA) en explicaciones claras y fáciles de entender en español.
|
| 16 |
|
| 17 |
+
## Demo
|
| 18 |
+
|
| 19 |
+
Ingresa un texto técnico (en inglés o español), y la aplicación:
|
| 20 |
+
- Traducirá al español si es necesario.
|
| 21 |
+
- Explicará el contenido en lenguaje sencillo (nivel secundario o básico).
|
| 22 |
+
|
| 23 |
+
## Cómo funciona
|
| 24 |
+
|
| 25 |
+
Este Space usa dos modelos de Hugging Face:
|
| 26 |
+
|
| 27 |
+
1. **Traducción (Inglés → Español):**
|
| 28 |
+
- [`Helsinki-NLP/opus-mt-en-es`](https://huggingface.co/Helsinki-NLP/opus-mt-en-es)
|
| 29 |
+
|
| 30 |
+
2. **Simplificación del lenguaje:**
|
| 31 |
+
- [`google/flan-t5-large`](https://huggingface.co/google/flan-t5-large)
|
| 32 |
+
|
| 33 |
+
## Tecnologías utilizadas
|
| 34 |
+
|
| 35 |
+
- [Streamlit](https://streamlit.io/)
|
| 36 |
+
- [Transformers](https://huggingface.co/docs/transformers)
|
| 37 |
+
- Modelos de Hugging Face
|
| 38 |
+
|
| 39 |
+
## Cómo usar localmente
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
git clone https://huggingface.co/spaces/<tu-usuario>/nasa-simplifier
|
| 43 |
+
cd nasa-simplifier
|
| 44 |
+
pip install -r requirements.txt
|
| 45 |
+
streamlit run app.py
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## Créditos
|
| 49 |
+
|
| 50 |
+
Desarrollado por [VicGerardoPR](https://huggingface.co/VicGerardoPR)
|
| 51 |
+
|
| 52 |
+
Inspirado en los modelos abiertos de la NASA y la misión de hacer accesible el conocimiento científico.
|
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from explain_utils import translate_text, simplify_text
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="NASA Report Simplifier", layout="wide")
|
| 5 |
+
|
| 6 |
+
st.title("Simplificador de Reportes Científicos de NASA")
|
| 7 |
+
st.markdown("Sube un texto técnico o artículo y conviértelo a lenguaje sencillo.")
|
| 8 |
+
|
| 9 |
+
input_text = st.text_area("Pega el contenido científico aquí:", height=300)
|
| 10 |
+
|
| 11 |
+
if st.button("Simplificar"):
|
| 12 |
+
if input_text.strip():
|
| 13 |
+
with st.spinner("Procesando..."):
|
| 14 |
+
translated = translate_text(input_text)
|
| 15 |
+
simplified = simplify_text(translated)
|
| 16 |
+
st.subheader("Texto simplificado:")
|
| 17 |
+
st.write(simplified)
|
| 18 |
+
else:
|
| 19 |
+
st.warning("Por favor, ingresa algún texto.")
|
explain_utils.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
# Traducción inglés a español
|
| 4 |
+
translator = pipeline("translation_en_to_es", model="Helsinki-NLP/opus-mt-en-es")
|
| 5 |
+
|
| 6 |
+
# Simplificación con modelo tipo LLM
|
| 7 |
+
simplifier = pipeline("text2text-generation", model="google/flan-t5-large")
|
| 8 |
+
|
| 9 |
+
def translate_text(text):
|
| 10 |
+
result = translator(text, max_length=512)
|
| 11 |
+
return result[0]['translation_text']
|
| 12 |
+
|
| 13 |
+
def simplify_text(text):
|
| 14 |
+
prompt = f"Explica este texto en lenguaje sencillo para estudiantes de secundaria:\n\n{text}"
|
| 15 |
+
result = simplifier(prompt, max_length=512)
|
| 16 |
+
return result[0]['generated_text']
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
transformers
|
| 3 |
+
torch
|