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