oceansweep commited on
Commit
0eb5564
1 Parent(s): 5abaf6f

Update App_Function_Libraries/Gradio_Related.py

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