oceansweep commited on
Commit
92c539d
·
verified ·
1 Parent(s): 66f5f38

Update App_Function_Libraries/Gradio_Related.py

Browse files
Files changed (1) hide show
  1. App_Function_Libraries/Gradio_Related.py +394 -395
App_Function_Libraries/Gradio_Related.py CHANGED
@@ -1,395 +1,394 @@
1
- # Gradio_Related.py
2
- #########################################
3
- # Gradio UI Functions Library
4
- # I fucking hate Gradio.
5
- # Yea, fuck Gradio. https://github.com/gradio-app/gradio/pull/8263 & https://github.com/gradio-app/gradio/issues/7968
6
- #
7
- #########################################
8
- #
9
- # Built-In Imports
10
- import logging
11
- import os
12
- #
13
- # Import 3rd-Party Libraries
14
- import gradio as gr
15
- #
16
- # Local Imports
17
- from App_Function_Libraries.DB.DB_Manager import get_db_config
18
- from App_Function_Libraries.Gradio_UI.Arxiv_tab import create_arxiv_tab
19
- from App_Function_Libraries.Gradio_UI.Audio_ingestion_tab import create_audio_processing_tab
20
- from App_Function_Libraries.Gradio_UI.Book_Ingestion_tab import create_import_book_tab
21
- from App_Function_Libraries.Gradio_UI.Character_Chat_tab import create_character_card_interaction_tab, \
22
- create_character_card_interaction_tab, create_character_chat_mgmt_tab
23
- from App_Function_Libraries.Gradio_UI.Character_interaction_tab import create_narrator_controlled_conversation_tab, \
24
- create_multiple_character_chat_tab
25
- from App_Function_Libraries.Gradio_UI.Chat_ui import create_chat_management_tab, \
26
- create_chat_interface_four, create_chat_interface_multi_api, create_chat_interface_stacked, create_chat_interface
27
- from App_Function_Libraries.Gradio_UI.Config_tab import create_config_editor_tab
28
- from App_Function_Libraries.Gradio_UI.Explain_summarize_tab import create_summarize_explain_tab
29
- from App_Function_Libraries.Gradio_UI.Export_Functionality import create_export_tab
30
- from App_Function_Libraries.Gradio_UI.Backup_Functionality import create_backup_tab, create_view_backups_tab, \
31
- create_restore_backup_tab
32
- from App_Function_Libraries.Gradio_UI.Import_Functionality import create_import_single_prompt_tab, \
33
- create_import_obsidian_vault_tab, create_import_item_tab, create_import_multiple_prompts_tab
34
- from App_Function_Libraries.Gradio_UI.Introduction_tab import create_introduction_tab
35
- from App_Function_Libraries.Gradio_UI.Keywords import create_view_keywords_tab, create_add_keyword_tab, \
36
- create_delete_keyword_tab, create_export_keywords_tab
37
- from App_Function_Libraries.Gradio_UI.Live_Recording import create_live_recording_tab
38
- from App_Function_Libraries.Gradio_UI.Llamafile_tab import create_chat_with_llamafile_tab
39
- #from App_Function_Libraries.Gradio_UI.MMLU_Pro_tab import create_mmlu_pro_tab
40
- from App_Function_Libraries.Gradio_UI.Media_edit import create_prompt_clone_tab, create_prompt_edit_tab, \
41
- create_media_edit_and_clone_tab, create_media_edit_tab
42
- from App_Function_Libraries.Gradio_UI.Media_wiki_tab import create_mediawiki_import_tab, create_mediawiki_config_tab
43
- from App_Function_Libraries.Gradio_UI.PDF_ingestion_tab import create_pdf_ingestion_tab, create_pdf_ingestion_test_tab
44
- from App_Function_Libraries.Gradio_UI.Plaintext_tab_import import create_plain_text_import_tab
45
- from App_Function_Libraries.Gradio_UI.Podcast_tab import create_podcast_tab
46
- from App_Function_Libraries.Gradio_UI.Prompt_Suggestion_tab import create_prompt_suggestion_tab
47
- from App_Function_Libraries.Gradio_UI.RAG_QA_Chat_tab import create_rag_qa_chat_tab
48
- from App_Function_Libraries.Gradio_UI.Re_summarize_tab import create_resummary_tab
49
- from App_Function_Libraries.Gradio_UI.Search_Tab import create_prompt_search_tab, \
50
- create_search_summaries_tab, create_search_tab
51
- from App_Function_Libraries.Gradio_UI.RAG_Chat_tab import create_rag_tab
52
- from App_Function_Libraries.Gradio_UI.Embeddings_tab import create_embeddings_tab, create_view_embeddings_tab, \
53
- create_purge_embeddings_tab
54
- from App_Function_Libraries.Gradio_UI.Trash import create_view_trash_tab, create_empty_trash_tab, \
55
- create_delete_trash_tab, create_search_and_mark_trash_tab
56
- from App_Function_Libraries.Gradio_UI.Utilities import create_utilities_yt_timestamp_tab, create_utilities_yt_audio_tab, \
57
- create_utilities_yt_video_tab
58
- from App_Function_Libraries.Gradio_UI.Video_transcription_tab import create_video_transcription_tab
59
- from App_Function_Libraries.Gradio_UI.View_tab import create_manage_items_tab
60
- from App_Function_Libraries.Gradio_UI.Website_scraping_tab import create_website_scraping_tab
61
- from App_Function_Libraries.Gradio_UI.Chat_Workflows import chat_workflows_tab
62
- from App_Function_Libraries.Gradio_UI.View_DB_Items_tab import create_prompt_view_tab, \
63
- create_view_all_with_versions_tab, create_viewing_tab
64
- #
65
- # Gradio UI Imports
66
- from App_Function_Libraries.Gradio_UI.Evaluations_Benchmarks_tab import create_geval_tab, create_infinite_bench_tab
67
-
68
- #
69
- #######################################################################################################################
70
- # Function Definitions
71
- #
72
-
73
-
74
- # Disable Gradio Analytics
75
- os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
76
-
77
-
78
- custom_prompt_input = None
79
- server_mode = False
80
- share_public = False
81
- custom_prompt_summarize_bulleted_notes = ("""
82
- <s>You are a bulleted notes specialist. [INST]```When creating comprehensive bulleted notes, you should follow these guidelines: Use multiple headings based on the referenced topics, not categories like quotes or terms. Headings should be surrounded by bold formatting and not be listed as bullet points themselves. Leave no space between headings and their corresponding list items underneath. Important terms within the content should be emphasized by setting them in bold font. Any text that ends with a colon should also be bolded. Before submitting your response, review the instructions, and make any corrections necessary to adhered to the specified format. Do not reference these instructions within the notes.``` \nBased on the content between backticks create comprehensive bulleted notes.[/INST]
83
- **Bulleted Note Creation Guidelines**
84
-
85
- **Headings**:
86
- - Based on referenced topics, not categories like quotes or terms
87
- - Surrounded by **bold** formatting
88
- - Not listed as bullet points
89
- - No space between headings and list items underneath
90
-
91
- **Emphasis**:
92
- - **Important terms** set in bold font
93
- - **Text ending in a colon**: also bolded
94
-
95
- **Review**:
96
- - Ensure adherence to specified format
97
- - Do not reference these instructions in your response.</s>[INST] {{ .Prompt }} [/INST]
98
- """)
99
- #
100
- # End of globals
101
- #######################################################################################################################
102
- #
103
- # Start of Video/Audio Transcription and Summarization Functions
104
- #
105
- # Functions:
106
- # FIXME
107
- #
108
- #
109
- ################################################################################################################
110
- # Functions for Re-Summarization
111
- #
112
- # Functions:
113
- # FIXME
114
- # End of Re-Summarization Functions
115
- #
116
- ############################################################################################################################################################################################################################
117
- #
118
- # Explain/Summarize This Tab
119
- #
120
- # Functions:
121
- # FIXME
122
- #
123
- #
124
- ############################################################################################################################################################################################################################
125
- #
126
- # Transcript Comparison Tab
127
- #
128
- # Functions:
129
- # FIXME
130
- #
131
- #
132
- ###########################################################################################################################################################################################################################
133
- #
134
- # Search Tab
135
- #
136
- # Functions:
137
- # FIXME
138
- #
139
- # End of Search Tab Functions
140
- #
141
- ##############################################################################################################################################################################################################################
142
- #
143
- # Llamafile Tab
144
- #
145
- # Functions:
146
- # FIXME
147
- #
148
- # End of Llamafile Tab Functions
149
- ##############################################################################################################################################################################################################################
150
- #
151
- # Chat Interface Tab Functions
152
- #
153
- # Functions:
154
- # FIXME
155
- #
156
- #
157
- # End of Chat Interface Tab Functions
158
- ################################################################################################################################################################################################################################
159
- #
160
- # Media Edit Tab Functions
161
- # Functions:
162
- # Fixme
163
- # create_media_edit_tab():
164
- ##### Trash Tab
165
- # FIXME
166
- # Functions:
167
- #
168
- # End of Media Edit Tab Functions
169
- ################################################################################################################
170
- #
171
- # Import Items Tab Functions
172
- #
173
- # Functions:
174
- #FIXME
175
- # End of Import Items Tab Functions
176
- ################################################################################################################
177
- #
178
- # Export Items Tab Functions
179
- #
180
- # Functions:
181
- # FIXME
182
- #
183
- #
184
- # End of Export Items Tab Functions
185
- ################################################################################################################
186
- #
187
- # Keyword Management Tab Functions
188
- #
189
- # Functions:
190
- # create_view_keywords_tab():
191
- # FIXME
192
- #
193
- # End of Keyword Management Tab Functions
194
- ################################################################################################################
195
- #
196
- # Document Editing Tab Functions
197
- #
198
- # Functions:
199
- # #FIXME
200
- #
201
- #
202
- ################################################################################################################
203
- #
204
- # Utilities Tab Functions
205
- # Functions:
206
- # create_utilities_yt_video_tab():
207
- # #FIXME
208
-
209
- #
210
- # End of Utilities Tab Functions
211
- ################################################################################################################
212
-
213
- # FIXME - Prompt sample box
214
- #
215
- # # Sample data
216
- # prompts_category_1 = [
217
- # "What are the key points discussed in the video?",
218
- # "Summarize the main arguments made by the speaker.",
219
- # "Describe the conclusions of the study presented."
220
- # ]
221
- #
222
- # prompts_category_2 = [
223
- # "How does the proposed solution address the problem?",
224
- # "What are the implications of the findings?",
225
- # "Can you explain the theory behind the observed phenomenon?"
226
- # ]
227
- #
228
- # all_prompts2 = prompts_category_1 + prompts_category_2
229
-
230
-
231
- def launch_ui(share_public=None, server_mode=False):
232
- share=share_public
233
- css = """
234
- .result-box {
235
- margin-bottom: 20px;
236
- border: 1px solid #ddd;
237
- padding: 10px;
238
- }
239
- .result-box.error {
240
- border-color: #ff0000;
241
- background-color: #ffeeee;
242
- }
243
- .transcription, .summary {
244
- max-height: 300px;
245
- overflow-y: auto;
246
- border: 1px solid #eee;
247
- padding: 10px;
248
- margin-top: 10px;
249
- }
250
- """
251
-
252
- with gr.Blocks(theme='bethecloud/storj_theme',css=css) as iface:
253
- db_config = get_db_config()
254
- db_type = db_config['type']
255
- gr.Markdown(f"# tl/dw: Your LLM-powered Research Multi-tool")
256
- gr.Markdown(f"(Using {db_type.capitalize()} Database)")
257
- with gr.Tabs():
258
- with gr.TabItem("Transcription / Summarization / Ingestion"):
259
- with gr.Tabs():
260
- create_video_transcription_tab()
261
- create_audio_processing_tab()
262
- create_podcast_tab()
263
- create_import_book_tab()
264
- create_plain_text_import_tab()
265
- create_website_scraping_tab()
266
- create_pdf_ingestion_tab()
267
- create_pdf_ingestion_test_tab()
268
- create_resummary_tab()
269
- create_summarize_explain_tab()
270
- create_live_recording_tab()
271
- create_arxiv_tab()
272
-
273
- with gr.TabItem("Text Search "):
274
- create_search_tab()
275
- create_search_summaries_tab()
276
-
277
- with gr.TabItem("RAG Search"):
278
- create_rag_tab()
279
- create_rag_qa_chat_tab()
280
-
281
- with gr.TabItem("Chat with an LLM"):
282
- create_chat_interface()
283
- create_chat_interface_stacked()
284
- create_chat_interface_multi_api()
285
- create_chat_interface_four()
286
- create_chat_with_llamafile_tab()
287
- create_chat_management_tab()
288
- chat_workflows_tab()
289
- create_multiple_character_chat_tab()
290
- create_narrator_controlled_conversation_tab()
291
-
292
-
293
- with gr.TabItem("Character Chat"):
294
- with gr.Tabs():
295
- create_character_card_interaction_tab()
296
- create_character_chat_mgmt_tab()
297
-
298
- with gr.TabItem("View DB Items"):
299
- # This one works
300
- create_view_all_with_versions_tab()
301
- # This one is WIP
302
- create_viewing_tab()
303
- create_prompt_view_tab()
304
-
305
- with gr.TabItem("Prompts"):
306
- create_prompt_view_tab()
307
- create_prompt_search_tab()
308
- create_prompt_edit_tab()
309
- create_prompt_clone_tab()
310
- create_prompt_suggestion_tab()
311
-
312
-
313
- with gr.TabItem("Manage / Edit Existing Items"):
314
- create_media_edit_tab()
315
- create_manage_items_tab()
316
- create_media_edit_and_clone_tab()
317
- # FIXME
318
- #create_compare_transcripts_tab()
319
-
320
- with gr.TabItem("Embeddings Management"):
321
- create_embeddings_tab()
322
- create_view_embeddings_tab()
323
- create_purge_embeddings_tab()
324
-
325
- with gr.TabItem("Writing Tools"):
326
- with gr.Tabs():
327
- from App_Function_Libraries.Gradio_UI.Writing_tab import create_document_feedback_tab
328
- create_document_feedback_tab()
329
- from App_Function_Libraries.Gradio_UI.Writing_tab import create_grammar_style_check_tab
330
- create_grammar_style_check_tab()
331
- from App_Function_Libraries.Gradio_UI.Writing_tab import create_tone_adjustment_tab
332
- create_tone_adjustment_tab()
333
- from App_Function_Libraries.Gradio_UI.Writing_tab import create_creative_writing_tab
334
- create_creative_writing_tab()
335
- from App_Function_Libraries.Gradio_UI.Writing_tab import create_mikupad_tab
336
- create_mikupad_tab()
337
-
338
-
339
- with gr.TabItem("Keywords"):
340
- create_view_keywords_tab()
341
- create_add_keyword_tab()
342
- create_delete_keyword_tab()
343
- create_export_keywords_tab()
344
-
345
- with gr.TabItem("Import"):
346
- create_import_item_tab()
347
- create_import_obsidian_vault_tab()
348
- create_import_single_prompt_tab()
349
- create_import_multiple_prompts_tab()
350
- create_mediawiki_import_tab()
351
- create_mediawiki_config_tab()
352
-
353
- with gr.TabItem("Export"):
354
- create_export_tab()
355
-
356
- with gr.TabItem("Backup Management"):
357
- create_backup_tab()
358
- create_view_backups_tab()
359
- create_restore_backup_tab()
360
-
361
- with gr.TabItem("Utilities"):
362
- create_utilities_yt_video_tab()
363
- create_utilities_yt_audio_tab()
364
- create_utilities_yt_timestamp_tab()
365
-
366
- with gr.TabItem("Trashcan"):
367
- create_search_and_mark_trash_tab()
368
- create_view_trash_tab()
369
- create_delete_trash_tab()
370
- create_empty_trash_tab()
371
-
372
- with gr.TabItem("Evaluations"):
373
- create_geval_tab()
374
- create_infinite_bench_tab()
375
- # FIXME
376
- #create_mmlu_pro_tab()
377
-
378
- with gr.TabItem("Introduction/Help"):
379
- create_introduction_tab()
380
-
381
- with gr.TabItem("Config Editor"):
382
- create_config_editor_tab()
383
-
384
- # Launch the interface
385
- server_port_variable = 7860
386
- os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
387
- if share==True:
388
- iface.launch(share=True)
389
- elif server_mode and not share_public:
390
- iface.launch(share=False, server_name="0.0.0.0", server_port=server_port_variable, )
391
- else:
392
- try:
393
- iface.launch(share=False, server_name="0.0.0.0", server_port=server_port_variable, )
394
- except Exception as e:
395
- logging.error(f"Error launching interface: {str(e)}")
 
1
+ # Gradio_Related.py
2
+ #########################################
3
+ # Gradio UI Functions Library
4
+ # I fucking hate Gradio.
5
+
6
+ #########################################
7
+ #
8
+ # Built-In Imports
9
+ import logging
10
+ import os
11
+ #
12
+ # Import 3rd-Party Libraries
13
+ import gradio as gr
14
+ #
15
+ # Local Imports
16
+ from App_Function_Libraries.DB.DB_Manager import get_db_config
17
+ from App_Function_Libraries.Gradio_UI.Arxiv_tab import create_arxiv_tab
18
+ from App_Function_Libraries.Gradio_UI.Audio_ingestion_tab import create_audio_processing_tab
19
+ from App_Function_Libraries.Gradio_UI.Book_Ingestion_tab import create_import_book_tab
20
+ from App_Function_Libraries.Gradio_UI.Character_Chat_tab import create_character_card_interaction_tab, \
21
+ create_character_card_interaction_tab, create_character_chat_mgmt_tab
22
+ from App_Function_Libraries.Gradio_UI.Character_interaction_tab import create_narrator_controlled_conversation_tab, \
23
+ create_multiple_character_chat_tab
24
+ from App_Function_Libraries.Gradio_UI.Chat_ui import create_chat_management_tab, \
25
+ create_chat_interface_four, create_chat_interface_multi_api, create_chat_interface_stacked, create_chat_interface
26
+ from App_Function_Libraries.Gradio_UI.Config_tab import create_config_editor_tab
27
+ from App_Function_Libraries.Gradio_UI.Explain_summarize_tab import create_summarize_explain_tab
28
+ from App_Function_Libraries.Gradio_UI.Export_Functionality import create_export_tab
29
+ from App_Function_Libraries.Gradio_UI.Backup_Functionality import create_backup_tab, create_view_backups_tab, \
30
+ create_restore_backup_tab
31
+ from App_Function_Libraries.Gradio_UI.Import_Functionality import create_import_single_prompt_tab, \
32
+ create_import_obsidian_vault_tab, create_import_item_tab, create_import_multiple_prompts_tab
33
+ from App_Function_Libraries.Gradio_UI.Introduction_tab import create_introduction_tab
34
+ from App_Function_Libraries.Gradio_UI.Keywords import create_view_keywords_tab, create_add_keyword_tab, \
35
+ create_delete_keyword_tab, create_export_keywords_tab
36
+ from App_Function_Libraries.Gradio_UI.Live_Recording import create_live_recording_tab
37
+ from App_Function_Libraries.Gradio_UI.Llamafile_tab import create_chat_with_llamafile_tab
38
+ #from App_Function_Libraries.Gradio_UI.MMLU_Pro_tab import create_mmlu_pro_tab
39
+ from App_Function_Libraries.Gradio_UI.Media_edit import create_prompt_clone_tab, create_prompt_edit_tab, \
40
+ create_media_edit_and_clone_tab, create_media_edit_tab
41
+ from App_Function_Libraries.Gradio_UI.Media_wiki_tab import create_mediawiki_import_tab, create_mediawiki_config_tab
42
+ from App_Function_Libraries.Gradio_UI.PDF_ingestion_tab import create_pdf_ingestion_tab, create_pdf_ingestion_test_tab
43
+ from App_Function_Libraries.Gradio_UI.Plaintext_tab_import import create_plain_text_import_tab
44
+ from App_Function_Libraries.Gradio_UI.Podcast_tab import create_podcast_tab
45
+ from App_Function_Libraries.Gradio_UI.Prompt_Suggestion_tab import create_prompt_suggestion_tab
46
+ from App_Function_Libraries.Gradio_UI.RAG_QA_Chat_tab import create_rag_qa_chat_tab
47
+ from App_Function_Libraries.Gradio_UI.Re_summarize_tab import create_resummary_tab
48
+ from App_Function_Libraries.Gradio_UI.Search_Tab import create_prompt_search_tab, \
49
+ create_search_summaries_tab, create_search_tab
50
+ from App_Function_Libraries.Gradio_UI.RAG_Chat_tab import create_rag_tab
51
+ from App_Function_Libraries.Gradio_UI.Embeddings_tab import create_embeddings_tab, create_view_embeddings_tab, \
52
+ create_purge_embeddings_tab
53
+ from App_Function_Libraries.Gradio_UI.Trash import create_view_trash_tab, create_empty_trash_tab, \
54
+ create_delete_trash_tab, create_search_and_mark_trash_tab
55
+ from App_Function_Libraries.Gradio_UI.Utilities import create_utilities_yt_timestamp_tab, create_utilities_yt_audio_tab, \
56
+ create_utilities_yt_video_tab
57
+ from App_Function_Libraries.Gradio_UI.Video_transcription_tab import create_video_transcription_tab
58
+ from App_Function_Libraries.Gradio_UI.View_tab import create_manage_items_tab
59
+ from App_Function_Libraries.Gradio_UI.Website_scraping_tab import create_website_scraping_tab
60
+ from App_Function_Libraries.Gradio_UI.Chat_Workflows import chat_workflows_tab
61
+ from App_Function_Libraries.Gradio_UI.View_DB_Items_tab import create_prompt_view_tab, \
62
+ create_view_all_with_versions_tab, create_viewing_tab
63
+ #
64
+ # Gradio UI Imports
65
+ from App_Function_Libraries.Gradio_UI.Evaluations_Benchmarks_tab import create_geval_tab, create_infinite_bench_tab
66
+
67
+ #
68
+ #######################################################################################################################
69
+ # Function Definitions
70
+ #
71
+
72
+
73
+ # Disable Gradio Analytics
74
+ os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
75
+
76
+
77
+ custom_prompt_input = None
78
+ server_mode = False
79
+ share_public = False
80
+ custom_prompt_summarize_bulleted_notes = ("""
81
+ <s>You are a bulleted notes specialist. [INST]```When creating comprehensive bulleted notes, you should follow these guidelines: Use multiple headings based on the referenced topics, not categories like quotes or terms. Headings should be surrounded by bold formatting and not be listed as bullet points themselves. Leave no space between headings and their corresponding list items underneath. Important terms within the content should be emphasized by setting them in bold font. Any text that ends with a colon should also be bolded. Before submitting your response, review the instructions, and make any corrections necessary to adhered to the specified format. Do not reference these instructions within the notes.``` \nBased on the content between backticks create comprehensive bulleted notes.[/INST]
82
+ **Bulleted Note Creation Guidelines**
83
+
84
+ **Headings**:
85
+ - Based on referenced topics, not categories like quotes or terms
86
+ - Surrounded by **bold** formatting
87
+ - Not listed as bullet points
88
+ - No space between headings and list items underneath
89
+
90
+ **Emphasis**:
91
+ - **Important terms** set in bold font
92
+ - **Text ending in a colon**: also bolded
93
+
94
+ **Review**:
95
+ - Ensure adherence to specified format
96
+ - Do not reference these instructions in your response.</s>[INST] {{ .Prompt }} [/INST]
97
+ """)
98
+ #
99
+ # End of globals
100
+ #######################################################################################################################
101
+ #
102
+ # Start of Video/Audio Transcription and Summarization Functions
103
+ #
104
+ # Functions:
105
+ # FIXME
106
+ #
107
+ #
108
+ ################################################################################################################
109
+ # Functions for Re-Summarization
110
+ #
111
+ # Functions:
112
+ # FIXME
113
+ # End of Re-Summarization Functions
114
+ #
115
+ ############################################################################################################################################################################################################################
116
+ #
117
+ # Explain/Summarize This Tab
118
+ #
119
+ # Functions:
120
+ # FIXME
121
+ #
122
+ #
123
+ ############################################################################################################################################################################################################################
124
+ #
125
+ # Transcript Comparison Tab
126
+ #
127
+ # Functions:
128
+ # FIXME
129
+ #
130
+ #
131
+ ###########################################################################################################################################################################################################################
132
+ #
133
+ # Search Tab
134
+ #
135
+ # Functions:
136
+ # FIXME
137
+ #
138
+ # End of Search Tab Functions
139
+ #
140
+ ##############################################################################################################################################################################################################################
141
+ #
142
+ # Llamafile Tab
143
+ #
144
+ # Functions:
145
+ # FIXME
146
+ #
147
+ # End of Llamafile Tab Functions
148
+ ##############################################################################################################################################################################################################################
149
+ #
150
+ # Chat Interface Tab Functions
151
+ #
152
+ # Functions:
153
+ # FIXME
154
+ #
155
+ #
156
+ # End of Chat Interface Tab Functions
157
+ ################################################################################################################################################################################################################################
158
+ #
159
+ # Media Edit Tab Functions
160
+ # Functions:
161
+ # Fixme
162
+ # create_media_edit_tab():
163
+ ##### Trash Tab
164
+ # FIXME
165
+ # Functions:
166
+ #
167
+ # End of Media Edit Tab Functions
168
+ ################################################################################################################
169
+ #
170
+ # Import Items Tab Functions
171
+ #
172
+ # Functions:
173
+ #FIXME
174
+ # End of Import Items Tab Functions
175
+ ################################################################################################################
176
+ #
177
+ # Export Items Tab Functions
178
+ #
179
+ # Functions:
180
+ # FIXME
181
+ #
182
+ #
183
+ # End of Export Items Tab Functions
184
+ ################################################################################################################
185
+ #
186
+ # Keyword Management Tab Functions
187
+ #
188
+ # Functions:
189
+ # create_view_keywords_tab():
190
+ # FIXME
191
+ #
192
+ # End of Keyword Management Tab Functions
193
+ ################################################################################################################
194
+ #
195
+ # Document Editing Tab Functions
196
+ #
197
+ # Functions:
198
+ # #FIXME
199
+ #
200
+ #
201
+ ################################################################################################################
202
+ #
203
+ # Utilities Tab Functions
204
+ # Functions:
205
+ # create_utilities_yt_video_tab():
206
+ # #FIXME
207
+
208
+ #
209
+ # End of Utilities Tab Functions
210
+ ################################################################################################################
211
+
212
+ # FIXME - Prompt sample box
213
+ #
214
+ # # Sample data
215
+ # prompts_category_1 = [
216
+ # "What are the key points discussed in the video?",
217
+ # "Summarize the main arguments made by the speaker.",
218
+ # "Describe the conclusions of the study presented."
219
+ # ]
220
+ #
221
+ # prompts_category_2 = [
222
+ # "How does the proposed solution address the problem?",
223
+ # "What are the implications of the findings?",
224
+ # "Can you explain the theory behind the observed phenomenon?"
225
+ # ]
226
+ #
227
+ # all_prompts2 = prompts_category_1 + prompts_category_2
228
+
229
+
230
+ def launch_ui(share_public=None, server_mode=False):
231
+ share=share_public
232
+ css = """
233
+ .result-box {
234
+ margin-bottom: 20px;
235
+ border: 1px solid #ddd;
236
+ padding: 10px;
237
+ }
238
+ .result-box.error {
239
+ border-color: #ff0000;
240
+ background-color: #ffeeee;
241
+ }
242
+ .transcription, .summary {
243
+ max-height: 300px;
244
+ overflow-y: auto;
245
+ border: 1px solid #eee;
246
+ padding: 10px;
247
+ margin-top: 10px;
248
+ }
249
+ """
250
+
251
+ with gr.Blocks(theme='bethecloud/storj_theme',css=css) as iface:
252
+ db_config = get_db_config()
253
+ db_type = db_config['type']
254
+ gr.Markdown(f"# tl/dw: Your LLM-powered Research Multi-tool")
255
+ gr.Markdown(f"(Using {db_type.capitalize()} Database)")
256
+ with gr.Tabs():
257
+ with gr.TabItem("Transcription / Summarization / Ingestion"):
258
+ with gr.Tabs():
259
+ create_video_transcription_tab()
260
+ create_audio_processing_tab()
261
+ create_podcast_tab()
262
+ create_import_book_tab()
263
+ create_plain_text_import_tab()
264
+ create_website_scraping_tab()
265
+ create_pdf_ingestion_tab()
266
+ create_pdf_ingestion_test_tab()
267
+ create_resummary_tab()
268
+ create_summarize_explain_tab()
269
+ create_live_recording_tab()
270
+ create_arxiv_tab()
271
+
272
+ with gr.TabItem("Text Search "):
273
+ create_search_tab()
274
+ create_search_summaries_tab()
275
+
276
+ with gr.TabItem("RAG Search"):
277
+ create_rag_tab()
278
+ create_rag_qa_chat_tab()
279
+
280
+ with gr.TabItem("Chat with an LLM"):
281
+ create_chat_interface()
282
+ create_chat_interface_stacked()
283
+ create_chat_interface_multi_api()
284
+ create_chat_interface_four()
285
+ create_chat_with_llamafile_tab()
286
+ create_chat_management_tab()
287
+ chat_workflows_tab()
288
+ create_multiple_character_chat_tab()
289
+ create_narrator_controlled_conversation_tab()
290
+
291
+
292
+ with gr.TabItem("Character Chat"):
293
+ with gr.Tabs():
294
+ create_character_card_interaction_tab()
295
+ create_character_chat_mgmt_tab()
296
+
297
+ with gr.TabItem("View DB Items"):
298
+ # This one works
299
+ create_view_all_with_versions_tab()
300
+ # This one is WIP
301
+ create_viewing_tab()
302
+ create_prompt_view_tab()
303
+
304
+ with gr.TabItem("Prompts"):
305
+ create_prompt_view_tab()
306
+ create_prompt_search_tab()
307
+ create_prompt_edit_tab()
308
+ create_prompt_clone_tab()
309
+ create_prompt_suggestion_tab()
310
+
311
+
312
+ with gr.TabItem("Manage / Edit Existing Items"):
313
+ create_media_edit_tab()
314
+ create_manage_items_tab()
315
+ create_media_edit_and_clone_tab()
316
+ # FIXME
317
+ #create_compare_transcripts_tab()
318
+
319
+ with gr.TabItem("Embeddings Management"):
320
+ create_embeddings_tab()
321
+ create_view_embeddings_tab()
322
+ create_purge_embeddings_tab()
323
+
324
+ with gr.TabItem("Writing Tools"):
325
+ with gr.Tabs():
326
+ from App_Function_Libraries.Gradio_UI.Writing_tab import create_document_feedback_tab
327
+ create_document_feedback_tab()
328
+ from App_Function_Libraries.Gradio_UI.Writing_tab import create_grammar_style_check_tab
329
+ create_grammar_style_check_tab()
330
+ from App_Function_Libraries.Gradio_UI.Writing_tab import create_tone_adjustment_tab
331
+ create_tone_adjustment_tab()
332
+ from App_Function_Libraries.Gradio_UI.Writing_tab import create_creative_writing_tab
333
+ create_creative_writing_tab()
334
+ from App_Function_Libraries.Gradio_UI.Writing_tab import create_mikupad_tab
335
+ create_mikupad_tab()
336
+
337
+
338
+ with gr.TabItem("Keywords"):
339
+ create_view_keywords_tab()
340
+ create_add_keyword_tab()
341
+ create_delete_keyword_tab()
342
+ create_export_keywords_tab()
343
+
344
+ with gr.TabItem("Import"):
345
+ create_import_item_tab()
346
+ create_import_obsidian_vault_tab()
347
+ create_import_single_prompt_tab()
348
+ create_import_multiple_prompts_tab()
349
+ create_mediawiki_import_tab()
350
+ create_mediawiki_config_tab()
351
+
352
+ with gr.TabItem("Export"):
353
+ create_export_tab()
354
+
355
+ with gr.TabItem("Backup Management"):
356
+ create_backup_tab()
357
+ create_view_backups_tab()
358
+ create_restore_backup_tab()
359
+
360
+ with gr.TabItem("Utilities"):
361
+ create_utilities_yt_video_tab()
362
+ create_utilities_yt_audio_tab()
363
+ create_utilities_yt_timestamp_tab()
364
+
365
+ with gr.TabItem("Trashcan"):
366
+ create_search_and_mark_trash_tab()
367
+ create_view_trash_tab()
368
+ create_delete_trash_tab()
369
+ create_empty_trash_tab()
370
+
371
+ with gr.TabItem("Evaluations"):
372
+ create_geval_tab()
373
+ create_infinite_bench_tab()
374
+ # FIXME
375
+ #create_mmlu_pro_tab()
376
+
377
+ with gr.TabItem("Introduction/Help"):
378
+ create_introduction_tab()
379
+
380
+ with gr.TabItem("Config Editor"):
381
+ create_config_editor_tab()
382
+
383
+ # Launch the interface
384
+ server_port_variable = 7860
385
+ os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
386
+ if share==True:
387
+ iface.launch(share=True)
388
+ elif server_mode and not share_public:
389
+ iface.launch(share=False, server_name="0.0.0.0", server_port=server_port_variable, )
390
+ else:
391
+ try:
392
+ iface.launch(share=False, server_name="0.0.0.0", server_port=server_port_variable, )
393
+ except Exception as e:
394
+ logging.error(f"Error launching interface: {str(e)}")