Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -556,7 +556,6 @@ def create_gradio_app():
|
|
556 |
"""
|
557 |
|
558 |
with gr.Blocks(css=css, title="π€ Creative Agentic AI Chat", theme=gr.themes.Ocean()) as app:
|
559 |
-
|
560 |
# Header
|
561 |
gr.HTML("""
|
562 |
<div class="header">
|
@@ -622,7 +621,108 @@ def create_gradio_app():
|
|
622 |
type="password",
|
623 |
info="Get your API key from: https://console.groq.com/"
|
624 |
)
|
625 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
# Advanced Settings
|
627 |
with gr.Accordion("βοΈ Advanced Settings", open=False, elem_id="neuroscope-accordion"):
|
628 |
with gr.Row():
|
@@ -851,105 +951,4 @@ if __name__ == "__main__":
|
|
851 |
share=True,
|
852 |
server_name="0.0.0.0",
|
853 |
server_port=7860
|
854 |
-
)
|
855 |
-
with gr.Column(scale=2):
|
856 |
-
model_selection = gr.Radio(
|
857 |
-
choices=[
|
858 |
-
"compound-beta",
|
859 |
-
"compound-beta-mini",
|
860 |
-
"openai/gpt-oss-20b",
|
861 |
-
"llama-3.3-70b-versatile",
|
862 |
-
"llama-3.1-70b-versatile",
|
863 |
-
"mixtral-8x7b-32768"
|
864 |
-
],
|
865 |
-
label="π§ Model Selection",
|
866 |
-
value="compound-beta",
|
867 |
-
info="Choose based on your search needs"
|
868 |
-
)
|
869 |
-
with gr.Column(scale=1):
|
870 |
-
connect_btn = gr.Button("π Connect", variant="primary", size="lg")
|
871 |
-
|
872 |
-
# Status display
|
873 |
-
status_display = gr.Markdown("### π Status: Not connected", elem_classes=["status-box"])
|
874 |
-
|
875 |
-
# Connect button functionality
|
876 |
-
connect_btn.click(
|
877 |
-
fn=validate_api_key,
|
878 |
-
inputs=[api_key, model_selection],
|
879 |
-
outputs=[status_display]
|
880 |
-
)
|
881 |
-
|
882 |
-
model_selection.change(
|
883 |
-
fn=update_model,
|
884 |
-
inputs=[model_selection],
|
885 |
-
outputs=[status_display]
|
886 |
-
)
|
887 |
-
|
888 |
-
# Main Chat Interface
|
889 |
-
with gr.Tab("π¬ Chat"):
|
890 |
-
chatbot = gr.Chatbot(
|
891 |
-
label="Creative AI Assistant with Enhanced Search",
|
892 |
-
height=500,
|
893 |
-
show_label=True,
|
894 |
-
bubble_full_width=False,
|
895 |
-
show_copy_button=True
|
896 |
-
)
|
897 |
-
|
898 |
-
with gr.Row():
|
899 |
-
msg = gr.Textbox(
|
900 |
-
label="Your Message",
|
901 |
-
placeholder="Type your message here...",
|
902 |
-
lines=3
|
903 |
-
)
|
904 |
-
with gr.Column():
|
905 |
-
send_btn = gr.Button("π€ Send", variant="primary")
|
906 |
-
clear_btn = gr.Button("ποΈ Clear", variant="secondary")
|
907 |
-
|
908 |
-
# Search Settings
|
909 |
-
with gr.Accordion("π Search Settings", open=False, elem_id="neuroscope-accordion"):
|
910 |
-
with gr.Row():
|
911 |
-
search_type = gr.Radio(
|
912 |
-
choices=["auto", "web_search", "browser_search", "none"],
|
913 |
-
label="π― Search Type",
|
914 |
-
value="auto",
|
915 |
-
info="Choose search method (auto = model decides)"
|
916 |
-
)
|
917 |
-
force_search = gr.Checkbox(
|
918 |
-
label="β‘ Force Search",
|
919 |
-
value=False,
|
920 |
-
info="Force AI to search even for general questions"
|
921 |
-
)
|
922 |
-
|
923 |
-
# Update search options when model changes
|
924 |
-
model_selection.change(
|
925 |
-
fn=get_search_options,
|
926 |
-
inputs=[model_selection],
|
927 |
-
outputs=[search_type]
|
928 |
-
)
|
929 |
-
|
930 |
-
# Domain Filtering Section (only for web search models)
|
931 |
-
with gr.Accordion("π Domain Filtering (Web Search Models Only)", open=False, elem_id="neuroscope-accordion"):
|
932 |
-
gr.Markdown("""
|
933 |
-
<div class="domain-info">
|
934 |
-
<h4>π Domain Filtering Guide</h4>
|
935 |
-
<p><strong>Note:</strong> Domain filtering only works with compound models (compound-beta, compound-beta-mini)</p>
|
936 |
-
<ul>
|
937 |
-
<li><strong>Include Domains:</strong> Only search these domains (comma-separated)</li>
|
938 |
-
<li><strong>Exclude Domains:</strong> Never search these domains (comma-separated)</li>
|
939 |
-
<li><strong>Examples:</strong> arxiv.org, *.edu, github.com, stackoverflow.com</li>
|
940 |
-
<li><strong>Wildcards:</strong> Use *.edu for all educational domains</li>
|
941 |
-
</ul>
|
942 |
-
</div>
|
943 |
-
""")
|
944 |
-
|
945 |
-
with gr.Row():
|
946 |
-
include_domains = gr.Textbox(
|
947 |
-
label="β
Include Domains (comma-separated)",
|
948 |
-
placeholder="arxiv.org, *.edu, github.com, stackoverflow.com",
|
949 |
-
info="Only search these domains (compound models only)"
|
950 |
-
)
|
951 |
-
exclude_domains = gr.Textbox(
|
952 |
-
label="β Exclude Domains (comma-separated)",
|
953 |
-
placeholder="wikipedia.org, reddit.com, twitter.com",
|
954 |
-
info="Never search these domains (compound models only)"
|
955 |
-
)
|
|
|
556 |
"""
|
557 |
|
558 |
with gr.Blocks(css=css, title="π€ Creative Agentic AI Chat", theme=gr.themes.Ocean()) as app:
|
|
|
559 |
# Header
|
560 |
gr.HTML("""
|
561 |
<div class="header">
|
|
|
621 |
type="password",
|
622 |
info="Get your API key from: https://console.groq.com/"
|
623 |
)
|
624 |
+
with gr.Column(scale=2):
|
625 |
+
model_selection = gr.Radio(
|
626 |
+
choices=[
|
627 |
+
"compound-beta",
|
628 |
+
"compound-beta-mini",
|
629 |
+
"openai/gpt-oss-20b",
|
630 |
+
"llama-3.3-70b-versatile",
|
631 |
+
"llama-3.1-70b-versatile",
|
632 |
+
"mixtral-8x7b-32768"
|
633 |
+
],
|
634 |
+
label="π§ Model Selection",
|
635 |
+
value="compound-beta",
|
636 |
+
info="Choose based on your search needs"
|
637 |
+
)
|
638 |
+
with gr.Column(scale=1):
|
639 |
+
connect_btn = gr.Button("π Connect", variant="primary", size="lg")
|
640 |
+
|
641 |
+
# Status display
|
642 |
+
status_display = gr.Markdown("### π Status: Not connected", elem_classes=["status-box"])
|
643 |
+
|
644 |
+
# Connect button functionality
|
645 |
+
connect_btn.click(
|
646 |
+
fn=validate_api_key,
|
647 |
+
inputs=[api_key, model_selection],
|
648 |
+
outputs=[status_display]
|
649 |
+
)
|
650 |
+
|
651 |
+
model_selection.change(
|
652 |
+
fn=update_model,
|
653 |
+
inputs=[model_selection],
|
654 |
+
outputs=[status_display]
|
655 |
+
)
|
656 |
+
|
657 |
+
# Main Chat Interface
|
658 |
+
with gr.Tab("π¬ Chat"):
|
659 |
+
chatbot = gr.Chatbot(
|
660 |
+
label="Creative AI Assistant with Enhanced Search",
|
661 |
+
height=500,
|
662 |
+
show_label=True,
|
663 |
+
bubble_full_width=False,
|
664 |
+
show_copy_button=True
|
665 |
+
)
|
666 |
+
|
667 |
+
with gr.Row():
|
668 |
+
msg = gr.Textbox(
|
669 |
+
label="Your Message",
|
670 |
+
placeholder="Type your message here...",
|
671 |
+
lines=3
|
672 |
+
)
|
673 |
+
with gr.Column():
|
674 |
+
send_btn = gr.Button("π€ Send", variant="primary")
|
675 |
+
clear_btn = gr.Button("ποΈ Clear", variant="secondary")
|
676 |
+
|
677 |
+
# Search Settings
|
678 |
+
with gr.Accordion("π Search Settings", open=False, elem_id="neuroscope-accordion"):
|
679 |
+
with gr.Row():
|
680 |
+
search_type = gr.Radio(
|
681 |
+
choices=["auto", "web_search", "browser_search", "none"],
|
682 |
+
label="π― Search Type",
|
683 |
+
value="auto",
|
684 |
+
info="Choose search method (auto = model decides)"
|
685 |
+
)
|
686 |
+
force_search = gr.Checkbox(
|
687 |
+
label="β‘ Force Search",
|
688 |
+
value=False,
|
689 |
+
info="Force AI to search even for general questions"
|
690 |
+
)
|
691 |
+
|
692 |
+
# Update search options when model changes
|
693 |
+
model_selection.change(
|
694 |
+
fn=get_search_options,
|
695 |
+
inputs=[model_selection],
|
696 |
+
outputs=[search_type]
|
697 |
+
)
|
698 |
+
|
699 |
+
# Domain Filtering Section (only for web search models)
|
700 |
+
with gr.Accordion("π Domain Filtering (Web Search Models Only)", open=False, elem_id="neuroscope-accordion"):
|
701 |
+
gr.Markdown("""
|
702 |
+
<div class="domain-info">
|
703 |
+
<h4>π Domain Filtering Guide</h4>
|
704 |
+
<p><strong>Note:</strong> Domain filtering only works with compound models (compound-beta, compound-beta-mini)</p>
|
705 |
+
<ul>
|
706 |
+
<li><strong>Include Domains:</strong> Only search these domains (comma-separated)</li>
|
707 |
+
<li><strong>Exclude Domains:</strong> Never search these domains (comma-separated)</li>
|
708 |
+
<li><strong>Examples:</strong> arxiv.org, *.edu, github.com, stackoverflow.com</li>
|
709 |
+
<li><strong>Wildcards:</strong> Use *.edu for all educational domains</li>
|
710 |
+
</ul>
|
711 |
+
</div>
|
712 |
+
""")
|
713 |
+
|
714 |
+
with gr.Row():
|
715 |
+
include_domains = gr.Textbox(
|
716 |
+
label="β
Include Domains (comma-separated)",
|
717 |
+
placeholder="arxiv.org, *.edu, github.com, stackoverflow.com",
|
718 |
+
info="Only search these domains (compound models only)"
|
719 |
+
)
|
720 |
+
exclude_domains = gr.Textbox(
|
721 |
+
label="β Exclude Domains (comma-separated)",
|
722 |
+
placeholder="wikipedia.org, reddit.com, twitter.com",
|
723 |
+
info="Never search these domains (compound models only)"
|
724 |
+
)
|
725 |
+
|
726 |
# Advanced Settings
|
727 |
with gr.Accordion("βοΈ Advanced Settings", open=False, elem_id="neuroscope-accordion"):
|
728 |
with gr.Row():
|
|
|
951 |
share=True,
|
952 |
server_name="0.0.0.0",
|
953 |
server_port=7860
|
954 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|