Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,6 @@ client = Groq(
|
|
| 8 |
api_key=os.environ.get("GROQ_API_KEY"),
|
| 9 |
)
|
| 10 |
|
| 11 |
-
# Function to clear the input field
|
| 12 |
-
def clear_input():
|
| 13 |
-
st.session_state["user_input"] = ""
|
| 14 |
-
|
| 15 |
# Function to process the input text
|
| 16 |
def process_text(input_text):
|
| 17 |
prompt = '''
|
|
@@ -21,14 +17,7 @@ def process_text(input_text):
|
|
| 21 |
- Evitar la jerga.
|
| 22 |
- Seguir el orden sujeto, verbo y predicado.
|
| 23 |
- Utilizar una estructura l贸gica, organizando la informaci贸n de manera clara y coherente.
|
| 24 |
-
Eval煤a la calidad del lenguaje de este texto y sugiere las correcciones oportunas
|
| 25 |
-
|
| 26 |
-
###TEXTO CORREGIDO###
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
###EXPLICACI脫N###
|
| 30 |
-
|
| 31 |
-
"
|
| 32 |
'''
|
| 33 |
input = prompt + input_text
|
| 34 |
|
|
@@ -47,10 +36,13 @@ def process_text(input_text):
|
|
| 47 |
st.write("# Inicio")
|
| 48 |
|
| 49 |
# Create a text input widget with session state
|
| 50 |
-
user_input
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# Create a button to submit the input
|
| 53 |
-
if st.button("
|
| 54 |
processed_output = process_text(user_input)
|
| 55 |
st.write('Texto procesado:', processed_output)
|
| 56 |
-
|
|
|
|
| 8 |
api_key=os.environ.get("GROQ_API_KEY"),
|
| 9 |
)
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Function to process the input text
|
| 12 |
def process_text(input_text):
|
| 13 |
prompt = '''
|
|
|
|
| 17 |
- Evitar la jerga.
|
| 18 |
- Seguir el orden sujeto, verbo y predicado.
|
| 19 |
- Utilizar una estructura l贸gica, organizando la informaci贸n de manera clara y coherente.
|
| 20 |
+
Eval煤a la calidad del lenguaje de este texto y sugiere las correcciones oportunas:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
'''
|
| 22 |
input = prompt + input_text
|
| 23 |
|
|
|
|
| 36 |
st.write("# Inicio")
|
| 37 |
|
| 38 |
# Create a text input widget with session state
|
| 39 |
+
if "user_input" not in st.session_state:
|
| 40 |
+
st.session_state["user_input"] = ""
|
| 41 |
+
|
| 42 |
+
user_input = st.text_input('Pega tu texto:', st.session_state["user_input"])
|
| 43 |
|
| 44 |
# Create a button to submit the input
|
| 45 |
+
if st.button("Submit"):
|
| 46 |
processed_output = process_text(user_input)
|
| 47 |
st.write('Texto procesado:', processed_output)
|
| 48 |
+
st.session_state["user_input"] = "" # Clear the input field after processing
|