oceansweep commited on
Commit
2cbb8f4
1 Parent(s): 0b8741e

Upload Gradio_Related.py

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