Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipline
|
| 3 |
+
|
| 4 |
+
st.title("Generaci贸n de Texto con Hugging Face")
|
| 5 |
+
st.write("Introduce un texto para que el modelo lo complete:")
|
| 6 |
+
|
| 7 |
+
user_input = st.text_area("Texto de entrada")
|
| 8 |
+
|
| 9 |
+
text_generator = pipline("text-generation", model="flax-community/gpt-2-spanish")
|
| 10 |
+
|
| 11 |
+
if user_input:
|
| 12 |
+
generated_text = text_generator(user_imput, max_length=50, num_return_sequences=1)
|
| 13 |
+
|
| 14 |
+
st.write("Texto Generado:")
|
| 15 |
+
st.write(generated_text[0]['generated_text'])
|
| 16 |
+
|
| 17 |
+
st.info("Este es un ejmemplo b谩sico de generaci贸n de texto utilizando un modelo preentrenado de Hugging Face.")
|