Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from openai import OpenAI
|
| 3 |
import os
|
| 4 |
-
|
| 5 |
-
# Import our new modules
|
| 6 |
import prompts
|
| 7 |
import file_processing
|
| 8 |
|
|
@@ -17,7 +15,7 @@ with st.sidebar:
|
|
| 17 |
st.header("⚙️ Controls")
|
| 18 |
|
| 19 |
# 1. Mode Selection (Pulled from prompts.py)
|
| 20 |
-
selected_mode = st.radio("Editing Mode", list(prompts.
|
| 21 |
|
| 22 |
st.divider()
|
| 23 |
|
|
@@ -67,7 +65,16 @@ if user_input := st.chat_input("Type instructions or paste text..."):
|
|
| 67 |
full_response = ""
|
| 68 |
|
| 69 |
# Construct Prompt: Base + Specific Mode
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
messages_payload = [{"role": "system", "content": system_instruction}] + st.session_state.messages
|
| 73 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from openai import OpenAI
|
| 3 |
import os
|
|
|
|
|
|
|
| 4 |
import prompts
|
| 5 |
import file_processing
|
| 6 |
|
|
|
|
| 15 |
st.header("⚙️ Controls")
|
| 16 |
|
| 17 |
# 1. Mode Selection (Pulled from prompts.py)
|
| 18 |
+
selected_mode = st.radio("Editing Mode", list(prompts.MODE_CONFIG.keys()))
|
| 19 |
|
| 20 |
st.divider()
|
| 21 |
|
|
|
|
| 65 |
full_response = ""
|
| 66 |
|
| 67 |
# Construct Prompt: Base + Specific Mode
|
| 68 |
+
config = prompts.MODE_CONFIG[selected_mode]
|
| 69 |
+
system_message = f"""
|
| 70 |
+
{prompts.BASE_SYSTEM_PROMPT}
|
| 71 |
+
|
| 72 |
+
CURRENT MODE: {selected_mode}
|
| 73 |
+
INSTRUCTION: {config['instruction']}
|
| 74 |
+
|
| 75 |
+
EXAMPLES OF DESIRED OUTPUT:
|
| 76 |
+
{config['examples']}
|
| 77 |
+
"""
|
| 78 |
|
| 79 |
messages_payload = [{"role": "system", "content": system_instruction}] + st.session_state.messages
|
| 80 |
|