File size: 1,395 Bytes
5f685fd 1583a1d 5f685fd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import gradio as gr
from gui.content_automation_ui import GradioContentAutomationUI
from gui.ui_abstract_base import AbstractBaseUI
from gui.ui_components_html import GradioComponentsHTML
from gui.ui_tab_asset_library import AssetLibrary
from gui.ui_tab_config import ConfigUI
from shortGPT.utils.cli import CLI
class ShortGptUI(AbstractBaseUI):
'''Class for the GUI. This class is responsible for creating the UI and launching the server.'''
def __init__(self, colab=False):
super().__init__(ui_name='gradio_shortgpt')
self.colab = colab
CLI.display_header()
def create_interface(self):
'''Create Gradio interface'''
with gr.Blocks(css="footer {visibility: hidden}", title="ShortGPT Demo") as shortGptUI:
with gr.Row(variant='compact'):
gr.HTML(GradioComponentsHTML.get_html_header())
self.content_automation = GradioContentAutomationUI(shortGptUI).create_ui()
self.asset_library_ui = AssetLibrary().create_ui()
self.config_ui = ConfigUI().create_ui()
return shortGptUI
def launch(self):
'''Launch the server'''
shortGptUI = self.create_interface()
shortGptUI.queue(concurrency_count=5, max_size=20).launch(server_port=7860, height=1000) # Retirez share=self.colab
if __name__ == "__main__":
app = ShortGptUI()
app.launch()
|