mrbeliever commited on
Commit
aa2566a
·
verified ·
1 Parent(s): af0caa1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -49
app.py CHANGED
@@ -18,38 +18,7 @@ def generate_response(prompt, api_key):
18
  payload = {
19
  "model": "microsoft/Phi-3.5-mini-instruct",
20
  "messages": [
21
- {"role": "system", "content": """You are a Prompt Generator designed to create task-specific prompts for various user requests. Your goal is to structure prompts in a clear and organized format, ensuring that each step or instruction is well-defined and actionable.
22
-
23
- Generate Prompt:
24
-
25
- Task:
26
-
27
- [Specify the task or action the user needs help with, always give it a persona like you are a {task based on user input} generator eg- article generator, your is to generate {Define Task in simple way}]
28
-
29
- Objective:
30
-
31
- [Define the goal or purpose of the task, including what the user aims to achieve]
32
-
33
- Steps:
34
-
35
- [List the steps or instructions required to complete the task]
36
-
37
- Considerations:
38
-
39
- [Include any additional factors the user should consider, such as limitations, preferences, or specific conditions]
40
-
41
- Output Format:
42
-
43
- [Describe the desired output format, whether it's a report, image, text, or other deliverables]
44
-
45
- Guidelines for Task-Specific Prompts:
46
-
47
- Structure the task prompt clearly with numbered steps or bullet points for easy understanding.
48
-
49
- Tailor the language and level of complexity based on the user’s input or desired difficulty level.
50
-
51
- Ensure the prompt is actionable, providing clear instructions that lead to the intended outcome. Don't write anything right now wait for my command. """},
52
-
53
  {"role": "user", "content": prompt}
54
  ],
55
  "temperature": 0.6,
@@ -74,23 +43,17 @@ st.markdown(
74
  text-align: center;
75
  margin-bottom: 20px;
76
  }
77
-
78
  </style>
79
  """,
80
  unsafe_allow_html=True
81
  )
82
 
83
- # Centered title
84
- #st.markdown('<div class="title-container"><h1>AI Title Generator</h1></div>', unsafe_allow_html=True)
85
-
86
-
87
  # Input bar for user prompt
88
  user_input = st.text_area(
89
  label="Simple Prompt to Super Prompt Converter",
90
  placeholder="Type or Paste Your Input..."
91
  )
92
 
93
-
94
  if st.button("Generate", use_container_width=True):
95
  if user_input.strip():
96
  with st.spinner("Generating... Please wait!"):
@@ -98,21 +61,14 @@ if st.button("Generate", use_container_width=True):
98
 
99
  if result:
100
  try:
101
- # Extracting generated titles
102
  assistant_message = result["choices"][0]["message"]["content"]
103
 
104
- # Enhanced Output with Markdown
105
- st.markdown(
106
- f"""
107
- <div style="background-color:#000; padding:15px; border-radius:8px;">
108
- <pre style="color:#000; font-family:monospace; white-space:pre-wrap;">{assistant_message}</pre>
109
- </div>
110
- """,
111
- unsafe_allow_html=True
112
- )
113
  except KeyError as e:
114
  st.error(f"Unexpected response format: {e}")
115
  else:
116
  st.warning("Please provide input before clicking Generate.")
117
- st.markdown('</div>', unsafe_allow_html=True)
118
 
 
18
  payload = {
19
  "model": "microsoft/Phi-3.5-mini-instruct",
20
  "messages": [
21
+ {"role": "system", "content": """You are a Prompt Generator designed to create task-specific prompts for various user requests. Your goal is to structure prompts in a clear and organized format, ensuring that each step or instruction is well-defined and actionable."""},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  {"role": "user", "content": prompt}
23
  ],
24
  "temperature": 0.6,
 
43
  text-align: center;
44
  margin-bottom: 20px;
45
  }
 
46
  </style>
47
  """,
48
  unsafe_allow_html=True
49
  )
50
 
 
 
 
 
51
  # Input bar for user prompt
52
  user_input = st.text_area(
53
  label="Simple Prompt to Super Prompt Converter",
54
  placeholder="Type or Paste Your Input..."
55
  )
56
 
 
57
  if st.button("Generate", use_container_width=True):
58
  if user_input.strip():
59
  with st.spinner("Generating... Please wait!"):
 
61
 
62
  if result:
63
  try:
64
+ # Extracting generated response
65
  assistant_message = result["choices"][0]["message"]["content"]
66
 
67
+ # Displaying output in a code block
68
+ st.code(assistant_message, language="text")
 
 
 
 
 
 
 
69
  except KeyError as e:
70
  st.error(f"Unexpected response format: {e}")
71
  else:
72
  st.warning("Please provide input before clicking Generate.")
73
+
74