codelion commited on
Commit
32cad41
ยท
verified ยท
1 Parent(s): 44aa7a0

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -41
app.py CHANGED
@@ -698,58 +698,68 @@ with gr.Blocks(title="OpenEvolve Prompt Optimizer", theme=gr.themes.Soft()) as d
698
  info="Use {input} as placeholder for dataset inputs"
699
  )
700
 
 
 
 
701
  optimize_btn = gr.Button("๐Ÿš€ Validate & Optimize Prompt", variant="primary", size="lg")
702
 
 
 
 
 
703
  with gr.Row():
704
  with gr.Column():
705
- summary = gr.Markdown(label="Summary")
706
 
707
  with gr.Row():
708
  with gr.Column():
709
- initial_results = gr.Markdown(label="Initial Results")
710
  with gr.Column():
711
- final_results = gr.Markdown(label="Evolved Results")
712
 
713
  with gr.Row():
714
  with gr.Column():
715
- evolution_progress = gr.Markdown(label="Evolution Progress", value="Evolution progress will appear here...")
716
-
717
- gr.Markdown("""
718
- ### Example Datasets & Fields:
719
-
720
- | Dataset | Split | Input Field | Target Field | Task |
721
- |---------|-------|-------------|--------------|------|
722
- | stanfordnlp/imdb | test | text | label | Sentiment Analysis |
723
- | rajpurkar/squad | validation | question | answers | Question Answering |
724
- | dair-ai/emotion | test | text | label | Emotion Classification |
725
- | openai/gsm8k | test | question | answer | Math Reasoning |
726
- | fancyzhx/ag_news | test | text | label | News Classification |
727
-
728
- ### About This Demo Space:
729
-
730
- **This is a demonstration space** showcasing OpenEvolve's prompt optimization capabilities.
731
- The interface shows you how the system works, but **you'll need to set up your own instance to run optimizations**.
732
-
733
- ### How to Run This Yourself:
734
-
735
- 1. **Clone this Space**: Click "โ‹ฎ" (three dots) at top-right โ†’ "Duplicate this Space"
736
- 2. **Set Environment Variables** in your cloned Space's settings:
737
- - `OPENAI_API_KEY`: Your OpenRouter API key (get free key at [openrouter.ai/keys](https://openrouter.ai/keys))
738
- - `HF_TOKEN`: (Optional) HuggingFace token for private datasets
739
- 3. **Configure Your Optimization**:
740
- - Dataset: Use full name format (e.g., `stanfordnlp/imdb` or `openai/gsm8k`)
741
- - Fields: Specify exact field names from the dataset schema
742
- - Model: Choose from 30+ free models (larger models = better results but slower/rate-limited)
743
- 4. **Run & Monitor**:
744
- - All inputs are validated before starting
745
- - Evolution takes 5-15 minutes (10 iterations, 100 samples per evaluation)
746
- - Watch evolution progress visualization in real-time
747
-
748
- ### About OpenEvolve:
749
- OpenEvolve is an open-source evolutionary optimization framework. Learn more at:
750
- - [GitHub Repository](https://github.com/algorithmicsuperintelligence/openevolve)
751
- - [Documentation](https://github.com/algorithmicsuperintelligence/openevolve#readme)
752
- """)
 
 
 
753
 
754
  optimize_btn.click(
755
  fn=optimize_prompt,
 
698
  info="Use {input} as placeholder for dataset inputs"
699
  )
700
 
701
+ # Button outside the column for better visibility
702
+ with gr.Row():
703
+ with gr.Column():
704
  optimize_btn = gr.Button("๐Ÿš€ Validate & Optimize Prompt", variant="primary", size="lg")
705
 
706
+ # Results section - clearly separated
707
+ gr.Markdown("---")
708
+ gr.Markdown("## ๐Ÿ“Š Results")
709
+
710
  with gr.Row():
711
  with gr.Column():
712
+ summary = gr.Markdown("Click 'Validate & Optimize Prompt' to start optimization...", visible=True)
713
 
714
  with gr.Row():
715
  with gr.Column():
716
+ initial_results = gr.Markdown("### Initial Results\nWill appear here after validation...", visible=True)
717
  with gr.Column():
718
+ final_results = gr.Markdown("### Final Results\nWill appear here after optimization...", visible=True)
719
 
720
  with gr.Row():
721
  with gr.Column():
722
+ evolution_progress = gr.Markdown("### Evolution Progress\nEvolution progress will appear here during optimization...", visible=True)
723
+
724
+ # Documentation section - in collapsible accordion
725
+ gr.Markdown("---")
726
+ with gr.Accordion("๐Ÿ“š Documentation & Examples", open=False):
727
+ gr.Markdown("""
728
+ ### Example Datasets & Fields:
729
+
730
+ | Dataset | Split | Input Field | Target Field | Task |
731
+ |---------|-------|-------------|--------------|------|
732
+ | stanfordnlp/imdb | test | text | label | Sentiment Analysis |
733
+ | rajpurkar/squad | validation | question | answers | Question Answering |
734
+ | dair-ai/emotion | test | text | label | Emotion Classification |
735
+ | openai/gsm8k | test | question | answer | Math Reasoning |
736
+ | fancyzhx/ag_news | test | text | label | News Classification |
737
+
738
+ ### About This Demo Space:
739
+
740
+ **This is a demonstration space** showcasing OpenEvolve's prompt optimization capabilities.
741
+ The interface shows you how the system works, but **you'll need to set up your own instance to run optimizations**.
742
+
743
+ ### How to Run This Yourself:
744
+
745
+ 1. **Clone this Space**: Click "โ‹ฎ" (three dots) at top-right โ†’ "Duplicate this Space"
746
+ 2. **Set Environment Variables** in your cloned Space's settings:
747
+ - `OPENAI_API_KEY`: Your OpenRouter API key (get free key at [openrouter.ai/keys](https://openrouter.ai/keys))
748
+ - `HF_TOKEN`: (Optional) HuggingFace token for private datasets
749
+ 3. **Configure Your Optimization**:
750
+ - Dataset: Use full name format (e.g., `stanfordnlp/imdb` or `openai/gsm8k`)
751
+ - Fields: Specify exact field names from the dataset schema
752
+ - Model: Choose from 30+ free models (larger models = better results but slower/rate-limited)
753
+ 4. **Run & Monitor**:
754
+ - All inputs are validated before starting
755
+ - Evolution takes 5-15 minutes (10 iterations, 100 samples per evaluation)
756
+ - Watch evolution progress visualization in real-time
757
+
758
+ ### About OpenEvolve:
759
+ OpenEvolve is an open-source evolutionary optimization framework. Learn more at:
760
+ - [GitHub Repository](https://github.com/algorithmicsuperintelligence/openevolve)
761
+ - [Documentation](https://github.com/algorithmicsuperintelligence/openevolve#readme)
762
+ """)
763
 
764
  optimize_btn.click(
765
  fn=optimize_prompt,