| import os |
| import gradio as gr |
|
|
| from app.gui import get_inputs_components, get_outputs_components, get_examples, get_desc |
| from app.handler import handler |
|
|
|
|
| def entry(): |
| REPO_ROOT = str(os.path.join(os.path.dirname(__file__), '..')) |
| os.system(f'touch {REPO_ROOT}/server_up') |
| os.system('lsof -i :7860 | grep LISTEN | awk \'{print $2}\' | xargs kill') |
|
|
| try: |
| demo = gr.Interface( |
| fn = handler, |
| inputs = get_inputs_components(), |
| outputs = get_outputs_components(), |
| examples = get_examples(), |
| description = get_desc(), |
| ) |
|
|
| demo.launch() |
| except Exception as e: |
| print(f'Error: {str(e)}') |
| os.system(f'rm {REPO_ROOT}/server_up') |
|
|
|
|
| if __name__ == '__main__': |
| entry() |