File size: 897 Bytes
b38461c cc07ecd b38461c 65b75e6 b38461c 052012f b38461c 052012f b38461c 65e2225 b38461c 65e2225 b38461c b8facf8 65e2225 b8facf8 61a4967 0c85fa3 65e2225 b38461c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import os
from groq import Groq
import gradio as gr
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
)
def eval_text (text):
prompt = "Eres un experto en lenguaje claro. Evalúa la calidad del lenguaje de este texto:"
input = prompt + text
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": input,
}
],
model="mixtral-8x7b-32768",
)
return (chat_completion.choices[0].message.content)
from PIL import Image
import matplotlib.pyplot as plt
pil_im = Image.open('endesa.jpeg')
plt.imshow(pil_im)
plt.show()
demo = gr.Interface(fn=eval_text, inputs="text", outputs="text", title="plAIn") #css='div {margin-left: auto; margin-right: auto; width: 100%;\ background-image: url("https://www.ucaragon.com/wp-content/uploads/2020/04/endesa-logo-nuevo-770.jpg"); repeat 0 0;}'
demo.launch() |