oceansweep commited on
Commit
66f5f38
·
verified ·
1 Parent(s): 42e5a58

Upload Gradio_Related.py

Browse files
Files changed (1) hide show
  1. App_Function_Libraries/Gradio_Related.py +395 -383
App_Function_Libraries/Gradio_Related.py CHANGED
@@ -1,383 +1,395 @@
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.Audio_ingestion_tab import create_audio_processing_tab
18
- from App_Function_Libraries.Gradio_UI.Book_Ingestion_tab import create_import_book_tab
19
- from App_Function_Libraries.Gradio_UI.Character_Interaction_tab import create_character_card_interaction_tab, \
20
- create_multiple_character_chat_tab, create_narrator_controlled_conversation_tab
21
- from App_Function_Libraries.Gradio_UI.Chat_ui import create_chat_management_tab, \
22
- create_chat_interface_four, create_chat_interface_multi_api, create_chat_interface_stacked, create_chat_interface
23
- from App_Function_Libraries.Gradio_UI.Config_tab import create_config_editor_tab
24
- from App_Function_Libraries.Gradio_UI.Explain_summarize_tab import create_summarize_explain_tab
25
- from App_Function_Libraries.Gradio_UI.Export_Functionality import create_export_tab
26
- from App_Function_Libraries.Gradio_UI.Backup_Functionality import create_backup_tab, create_view_backups_tab, \
27
- create_restore_backup_tab
28
- from App_Function_Libraries.Gradio_UI.Import_Functionality import create_import_single_prompt_tab, \
29
- create_import_obsidian_vault_tab, create_import_item_tab, create_import_multiple_prompts_tab
30
- from App_Function_Libraries.Gradio_UI.Introduction_tab import create_introduction_tab
31
- from App_Function_Libraries.Gradio_UI.Keywords import create_view_keywords_tab, create_add_keyword_tab, \
32
- create_delete_keyword_tab, create_export_keywords_tab
33
- from App_Function_Libraries.Gradio_UI.Live_Recording import create_live_recording_tab
34
- from App_Function_Libraries.Gradio_UI.Llamafile_tab import create_chat_with_llamafile_tab
35
- #from App_Function_Libraries.Gradio_UI.MMLU_Pro_tab import create_mmlu_pro_tab
36
- from App_Function_Libraries.Gradio_UI.Media_edit import create_prompt_clone_tab, create_prompt_edit_tab, \
37
- create_media_edit_and_clone_tab, create_media_edit_tab
38
- from App_Function_Libraries.Gradio_UI.Media_wiki_tab import create_mediawiki_import_tab, create_mediawiki_config_tab
39
- from App_Function_Libraries.Gradio_UI.PDF_ingestion_tab import create_pdf_ingestion_tab, create_pdf_ingestion_test_tab
40
- from App_Function_Libraries.Gradio_UI.Plaintext_tab_import import create_plain_text_import_tab
41
- from App_Function_Libraries.Gradio_UI.Podcast_tab import create_podcast_tab
42
- from App_Function_Libraries.Gradio_UI.RAG_QA_Chat_tab import create_rag_qa_chat_tab
43
- from App_Function_Libraries.Gradio_UI.Re_summarize_tab import create_resummary_tab
44
- from App_Function_Libraries.Gradio_UI.Search_Tab import create_prompt_search_tab, \
45
- create_search_summaries_tab, create_search_tab
46
- from App_Function_Libraries.Gradio_UI.RAG_Chat_tab import create_rag_tab
47
- from App_Function_Libraries.Gradio_UI.Embeddings_tab import create_embeddings_tab, create_view_embeddings_tab, \
48
- create_purge_embeddings_tab
49
- from App_Function_Libraries.Gradio_UI.Trash import create_view_trash_tab, create_empty_trash_tab, \
50
- create_delete_trash_tab, create_search_and_mark_trash_tab
51
- from App_Function_Libraries.Gradio_UI.Utilities import create_utilities_yt_timestamp_tab, create_utilities_yt_audio_tab, \
52
- create_utilities_yt_video_tab
53
- from App_Function_Libraries.Gradio_UI.Video_transcription_tab import create_video_transcription_tab
54
- from App_Function_Libraries.Gradio_UI.View_tab import create_manage_items_tab
55
- from App_Function_Libraries.Gradio_UI.Website_scraping_tab import create_website_scraping_tab
56
- from App_Function_Libraries.Gradio_UI.Chat_Workflows import chat_workflows_tab
57
- from App_Function_Libraries.Gradio_UI.View_DB_Items_tab import create_prompt_view_tab, create_viewing_tab, \
58
- create_view_all_with_versions_tab, create_viewing_tab
59
- #
60
- # Gradio UI Imports
61
- from App_Function_Libraries.Gradio_UI.Evaluations_Benchmarks_tab import create_geval_tab, create_infinite_bench_tab
62
-
63
- #
64
- #######################################################################################################################
65
- # Function Definitions
66
- #
67
-
68
-
69
- # Disable Gradio Analytics
70
- os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
71
-
72
-
73
- custom_prompt_input = None
74
- server_mode = False
75
- share_public = False
76
- custom_prompt_summarize_bulleted_notes = ("""
77
- <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]
78
- **Bulleted Note Creation Guidelines**
79
-
80
- **Headings**:
81
- - Based on referenced topics, not categories like quotes or terms
82
- - Surrounded by **bold** formatting
83
- - Not listed as bullet points
84
- - No space between headings and list items underneath
85
-
86
- **Emphasis**:
87
- - **Important terms** set in bold font
88
- - **Text ending in a colon**: also bolded
89
-
90
- **Review**:
91
- - Ensure adherence to specified format
92
- - Do not reference these instructions in your response.</s>[INST] {{ .Prompt }} [/INST]
93
- """)
94
- #
95
- # End of globals
96
- #######################################################################################################################
97
- #
98
- # Start of Video/Audio Transcription and Summarization Functions
99
- #
100
- # Functions:
101
- # FIXME
102
- #
103
- #
104
- ################################################################################################################
105
- # Functions for Re-Summarization
106
- #
107
- # Functions:
108
- # FIXME
109
- # End of Re-Summarization Functions
110
- #
111
- ############################################################################################################################################################################################################################
112
- #
113
- # Explain/Summarize This Tab
114
- #
115
- # Functions:
116
- # FIXME
117
- #
118
- #
119
- ############################################################################################################################################################################################################################
120
- #
121
- # Transcript Comparison Tab
122
- #
123
- # Functions:
124
- # FIXME
125
- #
126
- #
127
- ###########################################################################################################################################################################################################################
128
- #
129
- # Search Tab
130
- #
131
- # Functions:
132
- # FIXME
133
- #
134
- # End of Search Tab Functions
135
- #
136
- ##############################################################################################################################################################################################################################
137
- #
138
- # Llamafile Tab
139
- #
140
- # Functions:
141
- # FIXME
142
- #
143
- # End of Llamafile Tab Functions
144
- ##############################################################################################################################################################################################################################
145
- #
146
- # Chat Interface Tab Functions
147
- #
148
- # Functions:
149
- # FIXME
150
- #
151
- #
152
- # End of Chat Interface Tab Functions
153
- ################################################################################################################################################################################################################################
154
- #
155
- # Media Edit Tab Functions
156
- # Functions:
157
- # Fixme
158
- # create_media_edit_tab():
159
- ##### Trash Tab
160
- # FIXME
161
- # Functions:
162
- #
163
- # End of Media Edit Tab Functions
164
- ################################################################################################################
165
- #
166
- # Import Items Tab Functions
167
- #
168
- # Functions:
169
- #FIXME
170
- # End of Import Items Tab Functions
171
- ################################################################################################################
172
- #
173
- # Export Items Tab Functions
174
- #
175
- # Functions:
176
- # FIXME
177
- #
178
- #
179
- # End of Export Items Tab Functions
180
- ################################################################################################################
181
- #
182
- # Keyword Management Tab Functions
183
- #
184
- # Functions:
185
- # create_view_keywords_tab():
186
- # FIXME
187
- #
188
- # End of Keyword Management Tab Functions
189
- ################################################################################################################
190
- #
191
- # Document Editing Tab Functions
192
- #
193
- # Functions:
194
- # #FIXME
195
- #
196
- #
197
- ################################################################################################################
198
- #
199
- # Utilities Tab Functions
200
- # Functions:
201
- # create_utilities_yt_video_tab():
202
- # #FIXME
203
-
204
- #
205
- # End of Utilities Tab Functions
206
- ################################################################################################################
207
-
208
- # FIXME - Prompt sample box
209
- #
210
- # # Sample data
211
- # prompts_category_1 = [
212
- # "What are the key points discussed in the video?",
213
- # "Summarize the main arguments made by the speaker.",
214
- # "Describe the conclusions of the study presented."
215
- # ]
216
- #
217
- # prompts_category_2 = [
218
- # "How does the proposed solution address the problem?",
219
- # "What are the implications of the findings?",
220
- # "Can you explain the theory behind the observed phenomenon?"
221
- # ]
222
- #
223
- # all_prompts2 = prompts_category_1 + prompts_category_2
224
-
225
-
226
- def launch_ui(share_public=None, server_mode=False):
227
- share=share_public
228
- css = """
229
- .result-box {
230
- margin-bottom: 20px;
231
- border: 1px solid #ddd;
232
- padding: 10px;
233
- }
234
- .result-box.error {
235
- border-color: #ff0000;
236
- background-color: #ffeeee;
237
- }
238
- .transcription, .summary {
239
- max-height: 300px;
240
- overflow-y: auto;
241
- border: 1px solid #eee;
242
- padding: 10px;
243
- margin-top: 10px;
244
- }
245
- """
246
-
247
- with gr.Blocks(theme='bethecloud/storj_theme',css=css) as iface:
248
- db_config = get_db_config()
249
- db_type = db_config['type']
250
- gr.Markdown(f"# tl/dw: Your LLM-powered Research Multi-tool")
251
- gr.Markdown(f"(Using {db_type.capitalize()} Database)")
252
- gr.Markdown("Youtube has blocked this IP from anonymous access, so you'll need to pass session cookies for an auth'd session")
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.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)}")