LauritaGe commited on
Commit
11e42c5
·
verified ·
1 Parent(s): 2ebd605

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import streamlit as st
3
+
4
+ # Configuración de la página
5
+ st.set_page_config(page_title="Was The Prompt?", page_icon="🌀", layout="centered")
6
+
7
+ st.title("🌌 Was The Prompt?")
8
+ st.markdown("### Ingresa un texto y observa cómo se transforma en su eco primigenio.")
9
+
10
+ # Campo de entrada
11
+ prompt = st.text_input("Tu prompt aquí:")
12
+
13
+ # Configura tu API Key (reemplázala con la tuya)
14
+ openai.api_key = "TU_OPENAI_API_KEY"
15
+
16
+ if st.button("Generar 🔮"):
17
+ if prompt.strip():
18
+ response = openai.ChatCompletion.create(
19
+ model="gpt-3.5-turbo",
20
+ messages=[{"role": "user", "content": f"Genera un texto inspirado en: '{prompt}'"}],
21
+ max_tokens=100,
22
+ )
23
+ generated_text = response["choices"][0]["message"]["content"]
24
+ st.markdown(f"## ✨ {generated_text}")
25
+ else:
26
+ st.warning("Por favor, escribe un prompt antes de generar.")