Spaces:
Running
Running
Aitron Emper
commited on
Commit
•
8ce5a35
1
Parent(s):
3f8919a
Update app.py
Browse files
app.py
CHANGED
@@ -103,33 +103,9 @@ with gr.Blocks(theme=my_applio, title="Applio") as Applio:
|
|
103 |
# restart_tab()
|
104 |
|
105 |
|
106 |
-
def launch_gradio(
|
107 |
-
Applio.launch(
|
108 |
-
favicon_path="assets/ICON.ico",
|
109 |
-
share="--share" in sys.argv,
|
110 |
-
inbrowser="--open" in sys.argv,
|
111 |
-
server_port=port,
|
112 |
-
)
|
113 |
|
114 |
|
115 |
if __name__ == "__main__":
|
116 |
-
|
117 |
-
if "--port" in sys.argv:
|
118 |
-
port_index = sys.argv.index("--port") + 1
|
119 |
-
if port_index < len(sys.argv):
|
120 |
-
port = int(sys.argv[port_index])
|
121 |
-
|
122 |
-
launch_gradio(port)
|
123 |
-
|
124 |
-
else:
|
125 |
-
# if launch fails, decrement port number and try again (up to 10 times)
|
126 |
-
for i in range(10):
|
127 |
-
try:
|
128 |
-
launch_gradio(port)
|
129 |
-
break
|
130 |
-
except OSError:
|
131 |
-
print("Failed to launch on port", port, "- trying again...")
|
132 |
-
port -= 1
|
133 |
-
except Exception as e:
|
134 |
-
print(f"Unexpected error during launch: {e}")
|
135 |
-
break
|
|
|
103 |
# restart_tab()
|
104 |
|
105 |
|
106 |
+
def launch_gradio():
|
107 |
+
Applio.launch()
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
|
110 |
if __name__ == "__main__":
|
111 |
+
launch_gradio()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|