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