forked from pytorch/ao
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving Browser Related files into it's own directory (pytorch#845)
* Initial move of browser GUI related files * Fix css reference issue * Remove moved file
- Loading branch information
Showing
5 changed files
with
40 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import subprocess | ||
import sys | ||
|
||
|
||
def main(args): | ||
|
||
# Directory Containing the server file "chat_in_browser.py" | ||
server_dir = "browser" | ||
|
||
# Look for port from cmd args. Default to 5000 if not found. | ||
port = 5000 | ||
i = 2 | ||
while i < len(sys.argv): | ||
if sys.argv[i] == "--port": | ||
if i + 1 < len(sys.argv): | ||
# Extract the value and remove '--port' and the value from sys.argv | ||
port = sys.argv[i + 1] | ||
del sys.argv[i : i + 2] | ||
break | ||
else: | ||
i += 1 | ||
|
||
# Construct arguments for the flask app minus 'browser' command | ||
# plus '--chat' | ||
args_plus_chat = ["'{}'".format(s) for s in sys.argv[1:] if s != "browser"] + [ | ||
'"--chat"' | ||
] | ||
formatted_args = ", ".join(args_plus_chat) | ||
command = [ | ||
"flask", | ||
"--app", | ||
f"{server_dir}/chat_in_browser:create_app(" + formatted_args + ")", | ||
"run", | ||
"--port", | ||
f"{port}", | ||
] | ||
subprocess.run(command) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters