Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Tools
qim3d
Commits
abb4e450
Commit
abb4e450
authored
Nov 30, 2023
by
Felipe Delestro Matos
Browse files
Options
Downloads
Patches
Plain Diff
Hotfix to get the proper gradio port
parent
fc2c0cb6
No related branches found
No related tags found
1 merge request
!34
Hotfix to get the proper gradio port
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
qim3d/utils/internal_tools.py
+13
-4
13 additions, 4 deletions
qim3d/utils/internal_tools.py
with
13 additions
and
4 deletions
qim3d/utils/internal_tools.py
+
13
−
4
View file @
abb4e450
...
@@ -272,15 +272,24 @@ def run_gradio_app(gradio_interface):
...
@@ -272,15 +272,24 @@ def run_gradio_app(gradio_interface):
host
=
"
0.0.0.0
"
host
=
"
0.0.0.0
"
# Get port using the QIM API
# Get port using the QIM API
port_dict
=
get_port_dict
()
port_dict
=
get_port_dict
()
gradio_header
(
gradio_interface
.
title
,
port_dict
[
"
port
"
])
if
"
gradio_port
"
in
port_dict
:
port
=
port_dict
[
"
gradio_port
"
]
elif
"
port
"
in
port_dict
:
port
=
port_dict
[
"
port
"
]
else
:
raise
Exception
(
"
Port not specified from QIM API
"
)
print
(
port_dict
)
gradio_header
(
gradio_interface
.
title
,
port
)
# Create FastAPI with mounted gradio interface
# Create FastAPI with mounted gradio interface
app
=
FastAPI
()
app
=
FastAPI
()
path
=
f
"
/gui/
{
port_dict
[
'
username
'
]
}
/
{
port
_dict
[
'
port
'
]
}
/
"
path
=
f
"
/gui/
{
port_dict
[
'
username
'
]
}
/
{
port
}
/
"
app
=
gr
.
mount_gradio_app
(
app
,
gradio_interface
,
path
=
path
)
app
=
gr
.
mount_gradio_app
(
app
,
gradio_interface
,
path
=
path
)
# Full path
# Full path
print
(
f
"
http://
{
host
}
:
{
port
_dict
[
'
port
'
]
}{
path
}
"
)
print
(
f
"
http://
{
host
}
:
{
port
}{
path
}
"
)
# Run the FastAPI server usign uvicorn
# Run the FastAPI server usign uvicorn
run
(
app
,
host
=
"
0.0.0.0
"
,
port
=
int
(
port
_dict
[
"
port
"
]
))
run
(
app
,
host
=
"
0.0.0.0
"
,
port
=
int
(
port
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment