|
import streamlit as st |
|
from PIL import Image |
|
from groq import Groq |
|
import os |
|
|
|
st.image('endesa.jpeg', caption="", use_column_width=False) |
|
st.image('calamo.png', caption="", use_column_width=False) |
|
|
|
client = Groq( |
|
api_key=os.environ.get("GROQ_API_KEY"), |
|
) |
|
|
|
st.write("# Inicio") |
|
|
|
|
|
st.title("plAIn") |
|
|
|
|
|
user_input = st.text_input('Pega tu texto:', '') |
|
|
|
|
|
def process_text(input_text): |
|
prompt = "Eres un experto en lenguaje claro. Evalúa la calidad del lenguaje de este texto:" |
|
input = prompt + input_text |
|
|
|
chat_completion = client.chat.completions.create( |
|
messages=[ |
|
{ |
|
"role": "user", |
|
"content": input, |
|
} |
|
], |
|
model="mixtral-8x7b-32768", |
|
) |
|
return (chat_completion.choices[0].message.content) |
|
|
|
|
|
processed_output = process_text(user_input) |
|
|
|
|
|
st.write('Texto procesado:', processed_output) |