oceansweep commited on
Commit
dad5b36
·
verified ·
1 Parent(s): 7e9de24

Upload Gradio_Related.py

Browse files
App_Function_Libraries/Gradio_Related.py CHANGED
@@ -68,7 +68,6 @@ from App_Function_Libraries.Video_DL_Ingestion_Lib import parse_and_expand_urls,
68
  # Function Definitions
69
  #
70
 
71
- MISTRAL_TOKEN = os.environ["MISTRAL_KEY"]
72
  whisper_models = ["small", "medium", "small.en", "medium.en", "medium", "large", "large-v1", "large-v2", "large-v3",
73
  "distil-large-v2", "distil-medium.en", "distil-small.en"]
74
  custom_prompt_input = None
@@ -670,11 +669,8 @@ def create_video_transcription_tab():
670
  api_name_input = gr.Dropdown(
671
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
672
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
673
- value="Mistral",
674
- label="API Name (Mandatory)")
675
- api_key_input = gr.Textbox(label="API Key (Mandatory)", placeholder="Enter your API key here",
676
- type="password",
677
- value=MISTRAL_TOKEN)
678
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
679
  value="default,no_keyword_set")
680
  batch_size_input = gr.Slider(minimum=1, maximum=10, value=1, step=1,
@@ -1320,12 +1316,10 @@ def create_audio_processing_tab():
1320
  api_name_input = gr.Dropdown(
1321
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1322
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1323
- value="Mistral",
1324
  label="API for Summarization (Optional)"
1325
  )
1326
- api_key_input = gr.Textbox(label="API Key (if required)", placeholder="Enter your API key here",
1327
- type="password",
1328
- value=MISTRAL_TOKEN)
1329
  custom_keywords_input = gr.Textbox(label="Custom Keywords", placeholder="Enter custom keywords, comma-separated")
1330
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
1331
 
@@ -1430,12 +1424,10 @@ def create_podcast_tab():
1430
  podcast_api_name_input = gr.Dropdown(
1431
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp",
1432
  "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1433
- value="Mistral",
1434
  label="API Name for Summarization (Optional)"
1435
  )
1436
- podcast_api_key_input = gr.Textbox(label="API Key (if required)",
1437
- type="password",
1438
- value=MISTRAL_TOKEN)
1439
  podcast_whisper_model_input = gr.Dropdown(choices=whisper_models, value="medium", label="Whisper Model")
1440
 
1441
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
@@ -1553,13 +1545,9 @@ def create_website_scraping_tab():
1553
 
1554
  api_name_input = gr.Dropdown(
1555
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1556
- "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1557
- value="Mistral",
1558
- label="API Name (Mandatory for Summarization)")
1559
  api_key_input = gr.Textbox(label="API Key (Mandatory if API Name is specified)",
1560
- placeholder="Enter your API key here; Ignore if using Local API or Built-in API",
1561
- type="password",
1562
- value=MISTRAL_TOKEN)
1563
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
1564
  value="default,no_keyword_set", visible=True)
1565
 
@@ -1667,12 +1655,8 @@ def create_resummary_tab():
1667
  api_name_input = gr.Dropdown(
1668
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1669
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1670
- value="Mistral",
1671
- label="API Name")
1672
- api_key_input = gr.Textbox(label="API Key",
1673
- placeholder="Enter your API key here",
1674
- type="password",
1675
- value=MISTRAL_TOKEN)
1676
 
1677
  chunking_options_checkbox = gr.Checkbox(label="Use Chunking", value=False)
1678
  with gr.Row(visible=False) as chunking_options_box:
@@ -2869,13 +2853,9 @@ def create_chat_interface():
2869
  with gr.Row():
2870
  load_conversations_btn = gr.Button("Load Selected Conversation")
2871
 
2872
- api_endpoint = gr.Dropdown(label="Select API Endpoint",
2873
- choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
2874
- "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
2875
- value="Mistral")
2876
- api_key = gr.Textbox(label="API Key (if required)",
2877
- type="password",
2878
- value=MISTRAL_TOKEN)
2879
  custom_prompt_checkbox = gr.Checkbox(label="Use a Custom Prompt",
2880
  value=False,
2881
  visible=True)
@@ -3082,11 +3062,8 @@ def create_chat_interface_editable():
3082
 
3083
  api_endpoint = gr.Dropdown(label="Select API Endpoint",
3084
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
3085
- "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
3086
- value="Mistral")
3087
- api_key = gr.Textbox(label="API Key (if required)",
3088
- type="password",
3089
- value=MISTRAL_TOKEN)
3090
  # preset_prompt_checkbox = gr.Checkbox(label="Use a pre-set Prompt",
3091
  # value=False,
3092
  # visible=True)
@@ -3284,12 +3261,8 @@ def create_chat_interface_stacked():
3284
  search_conversations_btn = gr.Button("Search Conversations")
3285
  load_conversations_btn = gr.Button("Load Selected Conversation")
3286
  with gr.Column():
3287
- api_endpoint = gr.Dropdown(label="Select API Endpoint",
3288
- choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "OpenRouter", "Mistral", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
3289
- value="Mistral")
3290
- api_key = gr.Textbox(label="API Key (if required)",
3291
- type="password",
3292
- value=MISTRAL_TOKEN)
3293
  preset_prompt = gr.Dropdown(label="Select Preset Prompt",
3294
  choices=load_preset_prompts(),
3295
  visible=True)
@@ -3459,11 +3432,8 @@ def create_chat_interface_multi_api():
3459
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3460
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3461
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3462
- "Tabbyapi", "VLLM", "HuggingFace"],
3463
- value="Mistral")
3464
- api_key = gr.Textbox(label=f"API Key {i + 1} (if required)",
3465
- type="password",
3466
- value=MISTRAL_TOKEN)
3467
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3468
  chatbot = gr.Chatbot(height=800, elem_classes="chat-window")
3469
  chatbots.append(chatbot)
@@ -3573,9 +3543,8 @@ def create_chat_interface_four():
3573
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3574
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3575
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3576
- "Tabbyapi", "VLLM", "HuggingFace"],
3577
- value="Mistral")
3578
- api_key = gr.Textbox(label=f"API Key {i + 1} (if required)", type="password", value=MISTRAL_TOKEN)
3579
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3580
  chatbot = gr.Chatbot(height=400, elem_classes="chat-window")
3581
  msg = gr.Textbox(label=f"Enter your message for Chat {i + 1}")
@@ -3660,13 +3629,9 @@ def create_chat_interface_vertical():
3660
  use_prompt = gr.Checkbox(label="Use Prompt")
3661
  save_conversation = gr.Checkbox(label="Save Conversation", value=False)
3662
  with gr.Row():
3663
- api_endpoint = gr.Dropdown(label="Select API Endpoint",
3664
- choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
3665
- value="Mistral")
3666
  with gr.Row():
3667
- api_key = gr.Textbox(label="API Key (if required)",
3668
- type="password",
3669
- value=MISTRAL_TOKEN)
3670
  with gr.Row():
3671
  temperature = gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3672
  with gr.Row():
@@ -4360,12 +4325,9 @@ def create_import_item_tab():
4360
  api_name_input = gr.Dropdown(
4361
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4362
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4363
- label="API for Auto-summarization",
4364
- value="Mistral"
4365
  )
4366
- api_key_input = gr.Textbox(label="API Key",
4367
- type="password",
4368
- value=MISTRAL_TOKEN)
4369
  with gr.Row():
4370
  import_button = gr.Button("Import Data")
4371
  with gr.Row():
@@ -4697,12 +4659,9 @@ def create_import_book_tab():
4697
  api_name_input = gr.Dropdown(
4698
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4699
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4700
- label="API for Auto-summarization",
4701
- value="Mistral"
4702
  )
4703
- api_key_input = gr.Textbox(label="API Key",
4704
- type="password",
4705
- value=MISTRAL_TOKEN)
4706
  import_button = gr.Button("Import eBook")
4707
  with gr.Column():
4708
  with gr.Row():
@@ -5134,12 +5093,11 @@ def create_document_editing_tab():
5134
  api_name_input = gr.Dropdown(
5135
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5136
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5137
- value="Mistral",
5138
  label="API for Grammar Check"
5139
  )
5140
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5141
- type="password",
5142
- value=MISTRAL_TOKEN)
5143
  check_grammar_button = gr.Button("Check Grammar and Style")
5144
 
5145
  with gr.Column():
@@ -5164,12 +5122,11 @@ def create_document_editing_tab():
5164
  api_name_input = gr.Dropdown(
5165
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5166
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5167
- value="Mistral",
5168
  label="API for Grammar Check"
5169
  )
5170
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5171
- type="password",
5172
- value=MISTRAL_TOKEN)
5173
  adjust_btn = gr.Button("Adjust Tone")
5174
 
5175
  with gr.Column():
 
68
  # Function Definitions
69
  #
70
 
 
71
  whisper_models = ["small", "medium", "small.en", "medium.en", "medium", "large", "large-v1", "large-v2", "large-v3",
72
  "distil-large-v2", "distil-medium.en", "distil-small.en"]
73
  custom_prompt_input = None
 
669
  api_name_input = gr.Dropdown(
670
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
671
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
672
+ value=None, label="API Name (Mandatory)")
673
+ api_key_input = gr.Textbox(label="API Key (Mandatory)", placeholder="Enter your API key here", type="password")
 
 
 
674
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
675
  value="default,no_keyword_set")
676
  batch_size_input = gr.Slider(minimum=1, maximum=10, value=1, step=1,
 
1316
  api_name_input = gr.Dropdown(
1317
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1318
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1319
+ value=None,
1320
  label="API for Summarization (Optional)"
1321
  )
1322
+ api_key_input = gr.Textbox(label="API Key (if required)", placeholder="Enter your API key here", type="password")
 
 
1323
  custom_keywords_input = gr.Textbox(label="Custom Keywords", placeholder="Enter custom keywords, comma-separated")
1324
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
1325
 
 
1424
  podcast_api_name_input = gr.Dropdown(
1425
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp",
1426
  "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1427
+ value=None,
1428
  label="API Name for Summarization (Optional)"
1429
  )
1430
+ podcast_api_key_input = gr.Textbox(label="API Key (if required)", type="password")
 
 
1431
  podcast_whisper_model_input = gr.Dropdown(choices=whisper_models, value="medium", label="Whisper Model")
1432
 
1433
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
 
1545
 
1546
  api_name_input = gr.Dropdown(
1547
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1548
+ "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"], value=None, label="API Name (Mandatory for Summarization)")
 
 
1549
  api_key_input = gr.Textbox(label="API Key (Mandatory if API Name is specified)",
1550
+ placeholder="Enter your API key here; Ignore if using Local API or Built-in API", type="password")
 
 
1551
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
1552
  value="default,no_keyword_set", visible=True)
1553
 
 
1655
  api_name_input = gr.Dropdown(
1656
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1657
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1658
+ value="Local-LLM", label="API Name")
1659
+ api_key_input = gr.Textbox(label="API Key", placeholder="Enter your API key here", type="password")
 
 
 
 
1660
 
1661
  chunking_options_checkbox = gr.Checkbox(label="Use Chunking", value=False)
1662
  with gr.Row(visible=False) as chunking_options_box:
 
2853
  with gr.Row():
2854
  load_conversations_btn = gr.Button("Load Selected Conversation")
2855
 
2856
+ api_endpoint = gr.Dropdown(label="Select API Endpoint", choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
2857
+ "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
2858
+ api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
 
 
2859
  custom_prompt_checkbox = gr.Checkbox(label="Use a Custom Prompt",
2860
  value=False,
2861
  visible=True)
 
3062
 
3063
  api_endpoint = gr.Dropdown(label="Select API Endpoint",
3064
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
3065
+ "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
3066
+ api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
 
3067
  # preset_prompt_checkbox = gr.Checkbox(label="Use a pre-set Prompt",
3068
  # value=False,
3069
  # visible=True)
 
3261
  search_conversations_btn = gr.Button("Search Conversations")
3262
  load_conversations_btn = gr.Button("Load Selected Conversation")
3263
  with gr.Column():
3264
+ api_endpoint = gr.Dropdown(label="Select API Endpoint", choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "OpenRouter", "Mistral", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
3265
+ api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
 
 
3266
  preset_prompt = gr.Dropdown(label="Select Preset Prompt",
3267
  choices=load_preset_prompts(),
3268
  visible=True)
 
3432
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3433
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3434
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3435
+ "Tabbyapi", "VLLM", "HuggingFace"])
3436
+ api_key = gr.Textbox(label=f"API Key {i + 1} (if required)", type="password")
 
 
 
3437
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3438
  chatbot = gr.Chatbot(height=800, elem_classes="chat-window")
3439
  chatbots.append(chatbot)
 
3543
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3544
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3545
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3546
+ "Tabbyapi", "VLLM", "HuggingFace"])
3547
+ api_key = gr.Textbox(label=f"API Key {i + 1} (if required)", type="password")
 
3548
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3549
  chatbot = gr.Chatbot(height=400, elem_classes="chat-window")
3550
  msg = gr.Textbox(label=f"Enter your message for Chat {i + 1}")
 
3629
  use_prompt = gr.Checkbox(label="Use Prompt")
3630
  save_conversation = gr.Checkbox(label="Save Conversation", value=False)
3631
  with gr.Row():
3632
+ api_endpoint = gr.Dropdown(label="Select API Endpoint", choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
 
 
3633
  with gr.Row():
3634
+ api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
3635
  with gr.Row():
3636
  temperature = gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3637
  with gr.Row():
 
4325
  api_name_input = gr.Dropdown(
4326
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4327
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4328
+ label="API for Auto-summarization"
 
4329
  )
4330
+ api_key_input = gr.Textbox(label="API Key", type="password")
 
 
4331
  with gr.Row():
4332
  import_button = gr.Button("Import Data")
4333
  with gr.Row():
 
4659
  api_name_input = gr.Dropdown(
4660
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4661
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4662
+ label="API for Auto-summarization"
 
4663
  )
4664
+ api_key_input = gr.Textbox(label="API Key", type="password")
 
 
4665
  import_button = gr.Button("Import eBook")
4666
  with gr.Column():
4667
  with gr.Row():
 
5093
  api_name_input = gr.Dropdown(
5094
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5095
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5096
+ value=None,
5097
  label="API for Grammar Check"
5098
  )
5099
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5100
+ type="password")
 
5101
  check_grammar_button = gr.Button("Check Grammar and Style")
5102
 
5103
  with gr.Column():
 
5122
  api_name_input = gr.Dropdown(
5123
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5124
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5125
+ value=None,
5126
  label="API for Grammar Check"
5127
  )
5128
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5129
+ type="password")
 
5130
  adjust_btn = gr.Button("Adjust Tone")
5131
 
5132
  with gr.Column():