baconnier commited on
Commit
9840de1
1 Parent(s): b25d878

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -52
app.py CHANGED
@@ -7,7 +7,8 @@ from pydantic import BaseModel, Field
7
  from typing import Optional, Literal
8
  from huggingface_hub.errors import HfHubHTTPError
9
 
10
- from custom_css import all
 
11
 
12
  class PromptInput(BaseModel):
13
  text: str = Field(..., description="The initial prompt text")
@@ -278,59 +279,8 @@ class GradioInterface:
278
  def launch(self, share=False):
279
  self.interface.launch(share=share)
280
 
281
- metaprompt_explanations = {
282
- "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.",
283
- "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.",
284
- "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.",
285
- "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.",
286
- "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'.",
287
- "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.",
288
- "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."
289
- }
290
-
291
- models = [
292
- # Meta-Llama models (all support system)
293
- "meta-llama/Meta-Llama-3-70B-Instruct",
294
- "meta-llama/Meta-Llama-3-8B-Instruct",
295
- "meta-llama/Llama-3.1-70B-Instruct",
296
- "meta-llama/Llama-3.1-8B-Instruct",
297
- "meta-llama/Llama-3.2-3B-Instruct",
298
- "meta-llama/Llama-3.2-1B-Instruct",
299
- "meta-llama/Llama-2-13b-chat-hf",
300
- "meta-llama/Llama-2-7b-chat-hf",
301
-
302
- # HuggingFaceH4 models (support system)
303
- "HuggingFaceH4/zephyr-7b-beta",
304
- "HuggingFaceH4/zephyr-7b-alpha",
305
-
306
- # Qwen models (support system)
307
- "Qwen/Qwen2.5-72B-Instruct",
308
- "Qwen/Qwen2.5-1.5B",
309
-
310
- # Google models (supports system)
311
- "google/gemma-1.1-2b-it"
312
- ]
313
-
314
- explanation_markdown = "".join([f"- **{key}**: {value}\n" for key, value in metaprompt_explanations.items()])
315
 
316
  if __name__ == '__main__':
317
- meta_info=""
318
- api_token = os.getenv('HF_API_TOKEN')
319
- if not api_token:
320
- raise ValueError("HF_API_TOKEN not found in environment variables")
321
-
322
- metadone = os.getenv('metadone')
323
- prompt_refiner_model = os.getenv('prompt_refiner_model')
324
- echo_prompt_refiner = os.getenv('echo_prompt_refiner')
325
- metaprompt1 = os.getenv('metaprompt1')
326
- loic_metaprompt = os.getenv('loic_metaprompt')
327
- openai_metaprompt = os.getenv('openai_metaprompt')
328
- original_meta_prompt = os.getenv('original_meta_prompt')
329
- new_meta_prompt = os.getenv('new_meta_prompt')
330
- advanced_meta_prompt = os.getenv('advanced_meta_prompt')
331
- math_meta_prompt = os.getenv('metamath')
332
- autoregressive_metaprompt = os.getenv('autoregressive_metaprompt')
333
-
334
  prompt_refiner = PromptRefiner(api_token)
335
  gradio_interface = GradioInterface(prompt_refiner)
336
  gradio_interface.launch(share=True)
 
7
  from typing import Optional, Literal
8
  from huggingface_hub.errors import HfHubHTTPError
9
 
10
+ from custom_css import *
11
+ from variables import *
12
 
13
  class PromptInput(BaseModel):
14
  text: str = Field(..., description="The initial prompt text")
 
279
  def launch(self, share=False):
280
  self.interface.launch(share=share)
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
 
283
  if __name__ == '__main__':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  prompt_refiner = PromptRefiner(api_token)
285
  gradio_interface = GradioInterface(prompt_refiner)
286
  gradio_interface.launch(share=True)