Not-Grim-Refer commited on
Commit
4080e13
Β·
verified Β·
1 Parent(s): f91c4f8

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -54
app.py CHANGED
@@ -1,98 +1,100 @@
1
  import streamlit as st
2
 
3
- # Configure the page settings
4
  def configure_page():
5
  st.set_page_config(
6
- page_title="AI Instruction Processor",
7
- page_icon="πŸ€–",
8
  layout="wide"
9
  )
10
-
11
- # Apply custom styling
12
  st.markdown("""
13
  <style>
14
- .reportview-container {
15
- background: #0e1117;
16
- color: #ffffff;
17
  }
18
- .stTextInput > div > div > input {
19
- background-color: #2b303b;
20
- color: #ffffff;
21
  }
22
- .stTextArea > div > div > textarea {
23
- background-color: #2b303b;
24
- color: #ffffff;
25
  }
26
  </style>
27
  """, unsafe_allow_html=True)
28
 
29
- # Define the instruction template with placeholder
30
- INSTRUCTION_TEMPLATE = """
31
- Improve the following text according to these guidelines:
32
- - Make the language more professional and concise
33
- - Fix any grammar or spelling errors
34
- - Enhance clarity and readability
35
- - Maintain the original meaning
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- [INPUT_PLACEHOLDER]
38
  """
39
 
40
  def process_input(user_input):
41
- """Process the user input with the instruction template."""
42
- return INSTRUCTION_TEMPLATE.replace("[INPUT_PLACEHOLDER]", user_input)
43
 
44
  def display_history():
45
- """Display the conversation history."""
46
- st.markdown("### Previous Prompts")
47
- if 'conversation_history' in st.session_state:
48
- for idx, item in enumerate(reversed(st.session_state.conversation_history)):
49
- with st.expander(f"Prompt {len(st.session_state.conversation_history) - idx}", expanded=True):
50
- st.markdown("**Input Text:**")
51
  st.markdown(f"```\n{item['input']}\n```")
52
- st.markdown("**Generated Prompt:**")
53
  st.markdown(f"```\n{item['output']}\n```")
54
 
55
  def main():
56
- # Configure the page
57
  configure_page()
58
-
59
- # Initialize session state for conversation history
60
- if 'conversation_history' not in st.session_state:
61
- st.session_state.conversation_history = []
62
 
63
- # Main title and description
64
- st.title("πŸ€– AI Instruction Processor")
65
- st.markdown("Transform your input text using our predefined instruction set.")
 
 
66
 
67
- # Create two-column layout
68
  left_col, right_col = st.columns([2, 1])
69
 
70
  with left_col:
71
- # Input area
72
  user_input = st.text_area(
73
- "Enter your text:",
74
  height=200,
75
- placeholder="Paste your text here...",
76
- key="input_area"
77
  )
78
 
79
- # Process button
80
- if st.button("Generate Prompt", type="primary"):
81
  if user_input:
82
- # Generate the prompt
83
  result = process_input(user_input)
84
-
85
- # Save to conversation history
86
- st.session_state.conversation_history.append({
87
  'input': user_input,
88
  'output': result
89
  })
90
-
91
- # Display the result
92
- st.markdown("### Generated Prompt:")
93
  st.markdown(f"```\n{result}\n```")
94
 
95
- # Display history in right column
96
  with right_col:
97
  display_history()
98
 
 
1
  import streamlit as st
2
 
 
3
  def configure_page():
4
  st.set_page_config(
5
+ page_title="Instruction Set Integration",
6
+ page_icon="πŸ“œ",
7
  layout="wide"
8
  )
9
+
 
10
  st.markdown("""
11
  <style>
12
+ .reportview-container {
13
+ background: #0e1117;
14
+ color: #ffffff;
15
  }
16
+ .stTextInput > div > div > input {
17
+ background-color: #2b303b;
18
+ color: #ffffff;
19
  }
20
+ .stTextArea > div > div > textarea {
21
+ background-color: #2b303b;
22
+ color: #ffffff;
23
  }
24
  </style>
25
  """, unsafe_allow_html=True)
26
 
27
+ INSTRUCTION_SET = """
28
+ ### Technical Specification Enhancement Guidelines
29
+ 1. **Review and Understanding**
30
+ - Thoroughly analyze the provided text to fully comprehend the intended functionality and objectives of the application. This step is crucial for ensuring that all aspects of the project are accurately captured and articulated.
31
+ 2. **Use of Technical Language**
32
+ - Employ precise and appropriate technical terminology that aligns with industry standards. This includes using correct nomenclature for programming languages, frameworks, databases, and other technologies relevant to the project.
33
+ 3. **Preservation of Original Features**
34
+ - Ensure that all original features and functionalities described in the text are maintained in the revised document. Avoid introducing any new elements or features that were not part of the initial specification.
35
+ 4. **Coherent Organization**
36
+ - Structure the information in a logical and professional manner. Use headings, subheadings, bullet points, and numbered lists where appropriate to enhance readability and facilitate easy navigation through the document.
37
+ 5. **Clarification of Ambiguities**
38
+ - Identify and resolve any ambiguities present in the original text while preserving the original meaning. This may involve rephrasing sentences for clarity or providing additional context where necessary.
39
+ 6. **Best Practices in Full-Stack Development**
40
+ - Incorporate best practices and conventions that are relevant to full-stack development. This includes considerations for architecture, security, performance optimization, and user experience.
41
+ 7. **Focus on Application Outline**
42
+ - Concentrate on outlining the desired application and its functionalities rather than delving into the specifics of implementation. This should include high-level descriptions of components, user interactions, and data flow.
43
+ 8. **Identification of Missing Information**
44
+ - Carefully assess the text for any critical missing information that may be necessary for a comprehensive understanding of the project. Highlight these gaps without fabricating any details or making assumptions.
45
+ 9. **Demonstration of Expertise**
46
+ - Ensure that the revised document reflects a high level of expertise in full-stack development. This can be achieved through the use of advanced technical language, comprehensive coverage of relevant topics, and adherence to industry best practices.
47
+ 10. **Enhancement, Not Execution**
48
+ - Remember that the primary objective is to enhance the technical specification document. The focus should be on improving clarity, coherence, and professionalism, rather than executing the project itself.
49
+ By following these guidelines, the revised technical specification will provide a clear, professional, and comprehensive overview of the desired application, facilitating better understanding and communication among stakeholders.
50
 
51
+ [USER_INPUT_PLACEHOLDER]
52
  """
53
 
54
  def process_input(user_input):
55
+ return INSTRUCTION_SET.replace("[USER_INPUT_PLACEHOLDER]", user_input)
 
56
 
57
  def display_history():
58
+ st.markdown("### Previous Entries")
59
+ if 'entry_history' in st.session_state:
60
+ for idx, item in enumerate(reversed(st.session_state.entry_history)):
61
+ with st.expander(f"Entry {len(st.session_state.entry_history) - idx}", expanded=True):
62
+ st.markdown("**User Input:**")
 
63
  st.markdown(f"```\n{item['input']}\n```")
64
+ st.markdown("**Combined Output:**")
65
  st.markdown(f"```\n{item['output']}\n```")
66
 
67
  def main():
 
68
  configure_page()
 
 
 
 
69
 
70
+ if 'entry_history' not in st.session_state:
71
+ st.session_state.entry_history = []
72
+
73
+ st.title("πŸ“œ Instruction Set Integration")
74
+ st.markdown("Combine your input text with our instruction set.")
75
 
 
76
  left_col, right_col = st.columns([2, 1])
77
 
78
  with left_col:
 
79
  user_input = st.text_area(
80
+ "Your text here:",
81
  height=200,
82
+ placeholder="Enter text to combine with instruction set...",
83
+ key="user_text"
84
  )
85
 
86
+ if st.button("Combine Text", type="primary"):
 
87
  if user_input:
 
88
  result = process_input(user_input)
89
+
90
+ st.session_state.entry_history.append({
 
91
  'input': user_input,
92
  'output': result
93
  })
94
+
95
+ st.markdown("### Combined Output:")
 
96
  st.markdown(f"```\n{result}\n```")
97
 
 
98
  with right_col:
99
  display_history()
100