rdlf commited on
Commit
09780df
·
verified ·
1 Parent(s): b28c9c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -1,8 +1,13 @@
1
  import streamlit as st
2
  from PIL import Image
 
 
3
  st.image('endesa.jpeg', caption="", use_column_width=False)
4
  st.image('calamo.png', caption="", use_column_width=False)
5
 
 
 
 
6
  # Rest of your Streamlit app
7
  st.write("# Inicio")
8
 
@@ -14,8 +19,19 @@ user_input = st.text_input('Pega tu texto:', '')
14
 
15
  # Define a function to process the input
16
  def process_text(input_text):
17
- # Perform some operation on the input (e.g., convert to uppercase)
18
- return input_text.upper()
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  # Call the function with the user input
21
  processed_output = process_text(user_input)
 
1
  import streamlit as st
2
  from PIL import Image
3
+ from groq import Groq
4
+
5
  st.image('endesa.jpeg', caption="", use_column_width=False)
6
  st.image('calamo.png', caption="", use_column_width=False)
7
 
8
+ client = Groq(
9
+ api_key=os.environ.get("GROQ_API_KEY"),
10
+ )
11
  # Rest of your Streamlit app
12
  st.write("# Inicio")
13
 
 
19
 
20
  # Define a function to process the input
21
  def process_text(input_text):
22
+ prompt = "Eres un experto en lenguaje claro. Evalúa la calidad del lenguaje de este texto:"
23
+ input = prompt + text
24
+
25
+ chat_completion = client.chat.completions.create(
26
+ messages=[
27
+ {
28
+ "role": "user",
29
+ "content": input,
30
+ }
31
+ ],
32
+ model="mixtral-8x7b-32768",
33
+ )
34
+ return (chat_completion.choices[0].message.content)
35
 
36
  # Call the function with the user input
37
  processed_output = process_text(user_input)