Spaces:
Build error
Build error
Rename PromptCraft_PromptGenerator.py to appX.py
Browse files
PromptCraft_PromptGenerator.py → appX.py
RENAMED
|
@@ -1,9 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import openai
|
|
|
|
| 3 |
import os
|
| 4 |
-
|
| 5 |
-
from
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Set the OpenAI API key
|
| 9 |
# Retrieve OpenAI API key from environment variables
|
|
@@ -18,8 +51,16 @@ openai.api_key = openai_api_key
|
|
| 18 |
# openai.api_key = openai_api_key
|
| 19 |
|
| 20 |
# Streamlit page setup
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
#Add the image with a specified width
|
| 25 |
image_width = 300 # Set the desired width in pixels
|
|
@@ -29,7 +70,7 @@ st.image('/Users/cheynelevesseur/Desktop/Python_Code/LLM_Projects/LLM_Vision/MTS
|
|
| 29 |
# Streamlit app layout
|
| 30 |
# st.title("Research-backed Prompt Generator")
|
| 31 |
st.header('PromptCraft™ | Prompt Engineering')
|
| 32 |
-
st.subheader('
|
| 33 |
|
| 34 |
with st.sidebar:
|
| 35 |
# Password input field
|
|
|
|
| 1 |
+
#------------------------------------------------------------------------
|
| 2 |
+
# Import Modules
|
| 3 |
+
#------------------------------------------------------------------------
|
| 4 |
+
|
| 5 |
import streamlit as st
|
| 6 |
+
import openai
|
| 7 |
+
import random
|
| 8 |
import os
|
| 9 |
+
|
| 10 |
+
from langchain.chat_models import ChatOpenAI
|
| 11 |
+
# from langsmith import Client
|
| 12 |
+
# from langchain.smith import RunEvalConfig, run_on_dataset
|
| 13 |
+
|
| 14 |
+
#------------------------------------------------------------------------
|
| 15 |
+
# Load API Keys From the .env File, & OpenAI, Pinecone, and LangSmith Client
|
| 16 |
+
#------------------------------------------------------------------------
|
| 17 |
+
|
| 18 |
+
# Fetch the OpenAI API key from Streamlit secrets
|
| 19 |
+
os.environ["OPENAI_API_KEY"] = st.secrets["OPENAI_API_KEY"]
|
| 20 |
+
# Retrieve the OpenAI API Key from environment variable
|
| 21 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 22 |
+
# Initialize OpenAI Service
|
| 23 |
+
openai.api_key = OPENAI_API_KEY
|
| 24 |
+
|
| 25 |
+
# # Fetch LangSmith API key from Streamlit secrets
|
| 26 |
+
# # os.environ["LANGCHAIN_API_KEY"] = st.secrets["LANGCHAIN_API_KEY"]
|
| 27 |
+
# os.environ["LANGCHAIN_API_KEY"] = "ls__1819fb2979e44f0a9e410688d81c6390"
|
| 28 |
+
# os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
| 29 |
+
# os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
|
| 30 |
+
# os.environ["LANGCHAIN_PROJECT"] = "Inkqa"
|
| 31 |
+
# # Retrieve the LangSmith API Key from environment variable
|
| 32 |
+
# LANGCHAIN_API_KEY = os.getenv("LANGCHAIN_API_KEY")
|
| 33 |
+
# # Initialize LangSmith Service
|
| 34 |
+
# client = Client(api_key=LANGCHAIN_API_KEY) #langsmith client
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
|
| 41 |
# Set the OpenAI API key
|
| 42 |
# Retrieve OpenAI API key from environment variables
|
|
|
|
| 51 |
# openai.api_key = openai_api_key
|
| 52 |
|
| 53 |
# Streamlit page setup
|
| 54 |
+
st.set_page_config(
|
| 55 |
+
page_title="PromptCraft",
|
| 56 |
+
page_icon=":control_knobs:",
|
| 57 |
+
layout="centered",
|
| 58 |
+
initial_sidebar_state="auto",
|
| 59 |
+
menu_items={
|
| 60 |
+
'Get Help': 'mailto:calevess@gmail.com',
|
| 61 |
+
'About': "This app is built on the article *Principled Instructions Are All You Need*, which is accessible in the side bar"
|
| 62 |
+
}
|
| 63 |
+
)
|
| 64 |
|
| 65 |
#Add the image with a specified width
|
| 66 |
image_width = 300 # Set the desired width in pixels
|
|
|
|
| 70 |
# Streamlit app layout
|
| 71 |
# st.title("Research-backed Prompt Generator")
|
| 72 |
st.header('PromptCraft™ | Prompt Engineering')
|
| 73 |
+
st.subheader('Evidence-based Prompts')
|
| 74 |
|
| 75 |
with st.sidebar:
|
| 76 |
# Password input field
|