kwabs22
commited on
Commit
·
098fa9f
1
Parent(s):
35fa9a6
Lists in dictionary to avoid growing front end code
Browse files
app.py
CHANGED
@@ -94,76 +94,107 @@ def custom_generate_response(cust_user_message, prompt_index, prompts_list):
|
|
94 |
cust_user_message = f"{prompt}\n\n{cust_user_message}\n\n{ending}"
|
95 |
yield from generate_response(cust_user_message)
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
]
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
with gr.Blocks() as iface:
|
132 |
-
gr.
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
with gr.
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
with gr.
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
with gr.
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
iface.queue().launch(server_name="0.0.0.0", share=True)
|
|
|
94 |
cust_user_message = f"{prompt}\n\n{cust_user_message}\n\n{ending}"
|
95 |
yield from generate_response(cust_user_message)
|
96 |
|
97 |
+
Allprompts = {
|
98 |
+
"Custom Prompts" : [
|
99 |
+
("Write a Class Diagram based on the following text:", "Class Diagram:"),
|
100 |
+
("Write a Pydot code based on the following text:", "Pydot Code:"),
|
101 |
+
("Describe what a standard happy scene in any movie would be planned in great detail, based on the following text:", "Scene Details"),
|
102 |
+
("Explain a teardown of the product mentioned in the following text:", "Teardown Details:"),
|
103 |
+
("Explain the manufacturing of the product mentioned in the following text:", "Manufacturing Details:"),
|
104 |
+
("Explain the marketing considerations of the product mentioned in the following text:", "Considerations:"),
|
105 |
+
("Explain the target users considerations of the product mentioned in the following text:", "Target Users Considerations:"),
|
106 |
+
("My problem to solve is", "- please make 10 sub problems have to solve from this:"),
|
107 |
+
],
|
108 |
+
"Business Prompts" : [
|
109 |
+
("Suggest Product ideas just based off the following text:", "Products:"),
|
110 |
+
("Write an outline for a business plan for: " , ""),
|
111 |
+
("Write an example of a detailed report for a Executive Summary for " , "Executive Summary:"),
|
112 |
+
("Write an example of a detailed report for a Company Description for " , "Company Description:"),
|
113 |
+
("Write an example of a detailed report for a Market Analysis for " , "Market Analysis:"),
|
114 |
+
("Write an example of a detailed report for a Marketing and Sales Strategy for " , "Marketing and Sales Strategy:"),
|
115 |
+
("Write an example of a detailed report for a Product Development for " , "Product Development:"),
|
116 |
+
("Write an example of a detailed report for a Operations and Management for " , "Operations and Management:"),
|
117 |
+
("Write an example of a detailed report for a Financial Projections for " , "Financial Projections:"),
|
118 |
+
("Explain how this to make this product unique from competitors:", "Considerations:"),
|
119 |
+
],
|
120 |
+
"Programming Pattern Prompts" : [
|
121 |
+
("Demonstrate a builder pattern in go:", ""),
|
122 |
+
("Demonstrate a zero cost abstractions in go:", ""),
|
123 |
+
("Demonstrate a builder pattern in rust:", ""),
|
124 |
+
("Demonstrate a Polymorphism in rust:", ""),
|
125 |
+
("Explain how RAII pattern affects rust:", ""),
|
126 |
+
("Demonstrate a builder pattern in c++:", ""),
|
127 |
+
("Explain when to consider using a builder pattern in go:", ""),
|
128 |
+
],
|
129 |
+
"Creativity Prompts" : [
|
130 |
+
("Make the following text more vague:", "Vague version:"),
|
131 |
+
("Turn the following text into a bunch of rules:", "Rules:"),
|
132 |
+
("What Syllogisms can be made from this text:", "Syllogisms:"),
|
133 |
+
("Reimagine the following text:", ""),
|
134 |
+
],
|
135 |
+
"Game Based" : [
|
136 |
+
("What obstacles to growth exist in the following text:", "Obstacles:"),
|
137 |
+
("Write a story for the basis of a random game", ""),
|
138 |
+
("What are common themes in games?", ""),
|
139 |
+
("Write Three factions and why they are at conflict based on the following text:", "Faction 1:"),
|
140 |
+
]
|
141 |
+
}
|
142 |
|
143 |
with gr.Blocks() as iface:
|
144 |
+
with gr.Tab("Single prompt"):
|
145 |
+
gr.HTML("<a href='https://huggingface.co/spaces/stabilityai/stablelm-2-1_6b-zephyr'> -- Original StabilityAI demo -- </a> | ")
|
146 |
+
gr.Interface(
|
147 |
+
fn=generate_response,
|
148 |
+
inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
|
149 |
+
outputs="text",
|
150 |
+
title="Stable LM 2 Zephyr (1.6b) LLama.cpp Interface Test (Inconsistent Performance - 100 tokens in 50 secs (when this HF space is updated) or 800+ secs(HF space open for long))",
|
151 |
+
description="No Prompt template used yet (Essentially autocomplete). No Message History for now - Enter your message and get a response.",
|
152 |
+
flagging_dir="/usr/src/app/flagged",
|
153 |
+
)
|
154 |
+
|
155 |
+
gr.HTML("Any standard way of thinking / Repetitive idea / rule of thumb / advice can be turned into a button (In a timeline?)")
|
156 |
+
gr.HTML("LLM powered Buttons as the new notetaking? (Youtube Video to prompt pipeline?)<br><br>List to buttons (Instead of buttons tabs and dropdowns maybe?)")
|
157 |
+
|
158 |
+
MainOutput = gr.TextArea(placeholder='Output will show here')
|
159 |
+
CustomButtonInput = gr.TextArea(lines=1, placeholder='Prompt goes here')
|
160 |
+
|
161 |
+
# with gr.Accordion("Random Ideas"):
|
162 |
+
# with gr.Group():
|
163 |
+
# for index, (prompt, _) in enumerate(CustomPrompts):
|
164 |
+
# button = gr.Button(prompt)
|
165 |
+
# # Pass CustomPrompts list as an argument
|
166 |
+
# button.click(custom_generate_response, inputs=[CustomButtonInput, gr.State(index), gr.State(CustomPrompts)], outputs=MainOutput)
|
167 |
+
|
168 |
+
# with gr.Accordion("General Product and Business based", open=False):
|
169 |
+
# with gr.Group():
|
170 |
+
# for index, (prompt, _) in enumerate(BusinessPrompts):
|
171 |
+
# button = gr.Button(prompt)
|
172 |
+
# # Pass BusinessPrompts list as an argument
|
173 |
+
# button.click(custom_generate_response, inputs=[CustomButtonInput, gr.State(index), gr.State(BusinessPrompts)], outputs=MainOutput)
|
174 |
+
|
175 |
+
# with gr.Accordion("General Programming Pattern based", open=False):
|
176 |
+
# with gr.Group():
|
177 |
+
# for index, (prompt, _) in enumerate(ProgrammingPatternPrompts):
|
178 |
+
# button = gr.Button(prompt)
|
179 |
+
# # Pass BusinessPrompts list as an argument
|
180 |
+
# button.click(custom_generate_response, inputs=[CustomButtonInput, gr.State(index), gr.State(ProgrammingPatternPrompts)], outputs=MainOutput)
|
181 |
+
|
182 |
+
# with gr.Accordion("General Creativity Pattern based", open=False):
|
183 |
+
# with gr.Group():
|
184 |
+
# for index, (prompt, _) in enumerate(CreativityPrompts):
|
185 |
+
# button = gr.Button(prompt)
|
186 |
+
# # Pass BusinessPrompts list as an argument
|
187 |
+
# button.click(custom_generate_response, inputs=[CustomButtonInput, gr.State(index), gr.State(CreativityPrompts)], outputs=MainOutput)
|
188 |
+
|
189 |
+
for category_name, category_prompts in Allprompts.items():
|
190 |
+
with gr.Accordion(f"General {category_name} Pattern based"):
|
191 |
+
with gr.Group():
|
192 |
+
for index, (prompt, _) in enumerate(category_prompts):
|
193 |
+
button = gr.Button(prompt)
|
194 |
+
button.click(generate_response, inputs=[CustomButtonInput, gr.State(index), gr.State(category_name)], outputs=MainOutput)
|
195 |
+
|
196 |
+
|
197 |
+
with gr.Tab("Workflow Brainstom"):
|
198 |
+
gr.HTML("Workflow = premeditated events --- need a timeline before prompts")
|
199 |
|
200 |
iface.queue().launch(server_name="0.0.0.0", share=True)
|