yxmnjxzx commited on
Commit
c56a390
·
verified ·
1 Parent(s): 0e188b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -39
app.py CHANGED
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
7
  from typing import Optional, Literal
8
 
9
  from custom_css import custom_css
10
-
11
 
12
  class PromptInput(BaseModel):
13
  text: str = Field(..., description="The initial prompt text")
@@ -291,49 +291,31 @@ class GradioInterface:
291
  def launch(self, share=False):
292
  self.interface.launch(share=share)
293
 
294
- metaprompt_explanations = {
295
- "star": "Use ECHO when you need a comprehensive, multi-stage approach for complex prompts. It's ideal for tasks requiring in-depth analysis, exploration of multiple alternatives, and synthesis of ideas. Choose this over others when you have time for a thorough refinement process and need to consider various aspects of the prompt.",
296
- "superstar": "Use advanced ECHO when you need a comprehensive, multi-stage approach for complex prompts. It's ideal for tasks requiring in-depth analysis, exploration of multiple alternatives, and synthesis of ideas. Choose this over others when you have time for a thorough refinement process and need to consider various aspects of the prompt.",
297
- "done": "Opt for this when you want a structured approach with emphasis on role-playing and advanced techniques. It's particularly useful for tasks that benefit from diverse perspectives and complex reasoning. Prefer this over 'physics' when you need a more detailed, step-by-step refinement process.",
298
- "physics": "Select this when you need a balance between structure and advanced techniques, with a focus on role-playing. It's similar to 'done' but may be more suitable for scientific or technical prompts. Choose this over 'done' for a slightly less complex approach.",
299
- "morphosis": "Use this simplified approach for straightforward prompts or when time is limited. It focuses on essential improvements without complex techniques. Prefer this over other methods when you need quick, clear refinements without extensive analysis.",
300
- "verse": "Choose this method when you need to analyze and improve a prompt's strengths and weaknesses, with a focus on information flow. It's particularly useful for enhancing the logical structure of prompts. Use this over 'morphosis' when you need more depth but less complexity than 'star'.",
301
- "phor": "Employ this advanced approach when you need to combine multiple prompt engineering techniques. It's ideal for complex tasks requiring both clarity and sophisticated prompting methods. Select this over 'star' when you want a more flexible, technique-focused approach.",
302
- "bolism": "Utilize this method when working with autoregressive language models and when the task requires careful reasoning before conclusions. It's best for prompts that need detailed output formatting. Choose this over others when the prompt's structure and reasoning order are crucial.",
303
- "math": "Apply advanced mathematical and logical reasoning techniques to refine the given prompt, ensuring clarity, specificity, and effectiveness. It's best for prompts that deal with math."
304
- }
305
-
306
- models = [
307
- "llama-3.1-70b-versatile",
308
- "llama3-groq-70b-8192-tool-use-preview",
309
- "llama-3.2-90b-text-preview",
310
- "llama-3.2-90b-vision-preview",
311
- "llama3-groq-70b-8192-tool-use-preview",
312
- "mixtral-8x7b-32768"
313
- ]
314
 
315
- explanation_markdown = "".join([f"- **{key}**: {value}\n" for key, value in metaprompt_explanations.items()])
316
-
317
- # Main code to run the application
318
- if __name__ == '__main__':
319
- api_key = os.getenv('GROQ_API_KEY')
320
- if not api_key:
321
- raise ValueError("GROQ_API_KEY not found in environment variables")
322
 
323
 
324
- metadone=os.getenv('metadone')
325
- echo_prompt_refiner = os.getenv('echo_prompt_refiner')
326
- advanced_echo_prompt_refiner = os.getenv('advanced_echo_prompt_refiner')
327
- metaprompt1 = os.getenv('metaprompt1')
328
- loic_metaprompt = os.getenv('loic_metaprompt')
329
- openai_metaprompt=os.getenv('openai_metaprompt')
330
- original_meta_prompt = os.getenv('original_meta_prompt')
331
- new_meta_prompt = os.getenv('new_meta_prompt')
332
- advanced_meta_prompt = os.getenv('advanced_meta_prompt')
333
- math_meta_prompt = os.getenv('math_meta_prompt')
334
- math_meta = os.getenv('math_meta')
 
335
 
336
 
 
 
337
  prompt_refiner = PromptRefiner(api_key)
338
  gradio_interface = GradioInterface(prompt_refiner,custom_css)
339
  gradio_interface.launch(share=True)
 
7
  from typing import Optional, Literal
8
 
9
  from custom_css import custom_css
10
+ from variables import *
11
 
12
  class PromptInput(BaseModel):
13
  text: str = Field(..., description="The initial prompt text")
 
291
  def launch(self, share=False):
292
  self.interface.launch(share=share)
293
 
294
+ # explanation_markdown = "".join([f"- **{key}**: {value}\n" for key, value in metaprompt_explanations.items()])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
 
296
+ ```
297
+ meta_info=""
298
+ api_key = os.getenv('GROQ_API_KEY')
299
+ if not api_key:
300
+ raise ValueError("GROQ_API_KEY not found in environment variables")
 
 
301
 
302
 
303
+ metadone=os.getenv('metadone')
304
+ echo_prompt_refiner = os.getenv('echo_prompt_refiner')
305
+ advanced_echo_prompt_refiner = os.getenv('advanced_echo_prompt_refiner')
306
+ metaprompt1 = os.getenv('metaprompt1')
307
+ loic_metaprompt = os.getenv('loic_metaprompt')
308
+ openai_metaprompt=os.getenv('openai_metaprompt')
309
+ original_meta_prompt = os.getenv('original_meta_prompt')
310
+ new_meta_prompt = os.getenv('new_meta_prompt')
311
+ advanced_meta_prompt = os.getenv('advanced_meta_prompt')
312
+ math_meta_prompt = os.getenv('math_meta_prompt')
313
+ math_meta = os.getenv('math_meta')
314
+ ```
315
 
316
 
317
+ # Main code to run the application
318
+ if __name__ == '__main__':
319
  prompt_refiner = PromptRefiner(api_key)
320
  gradio_interface = GradioInterface(prompt_refiner,custom_css)
321
  gradio_interface.launch(share=True)