Kazuto Nakashima commited on
Commit
df6aa95
·
1 Parent(s): 6debac2

update sdk_version to 6.6.0 and refactor Gradio app launch configuration

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +24 -21
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🚗
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 5.22.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 6.6.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -5,10 +5,12 @@ import gradio as gr
5
  import matplotlib.cm as cm
6
  import numpy as np
7
  import plotly.graph_objects as go
 
8
  import torch
9
  import torch.nn.functional as F
10
  import torchdiffeq
11
 
 
12
  DESCRIPTION = """
13
  <div class="head">
14
  <div class="title">Fast LiDAR Data Generation with Rectified Flows</div>
@@ -92,6 +94,7 @@ def model_verbose(model, nfe, progress):
92
  return _model
93
 
94
 
 
95
  def generate(nfe: int, solver: str, phase: str, progress=gr.Progress()):
96
  model, lidar_utils, _ = torch.hub.load(config=model_dict[phase], **torch_hub_kwargs)
97
 
@@ -170,26 +173,7 @@ def setup_dropdown(value):
170
  return dropdown_solver, dropdown_nfe
171
 
172
 
173
- with gr.Blocks(
174
- css="""
175
- .head {
176
- text-align: center;
177
- display: block;
178
- font-size: var(--text-xl);
179
- }
180
-
181
- .title {
182
- font-size: var(--text-xxl);
183
- font-weight: bold;
184
- margin-top: 2rem;
185
- }
186
-
187
- .description {
188
- font-size: var(--text-lg);
189
- }
190
- """,
191
- theme=gr.themes.Ocean(),
192
- ) as demo:
193
  gr.HTML(DESCRIPTION)
194
 
195
  with gr.Row(variant="panel"):
@@ -222,4 +206,23 @@ with gr.Blocks(
222
 
223
 
224
  demo.queue()
225
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  import matplotlib.cm as cm
6
  import numpy as np
7
  import plotly.graph_objects as go
8
+ import spaces
9
  import torch
10
  import torch.nn.functional as F
11
  import torchdiffeq
12
 
13
+
14
  DESCRIPTION = """
15
  <div class="head">
16
  <div class="title">Fast LiDAR Data Generation with Rectified Flows</div>
 
94
  return _model
95
 
96
 
97
+ @spaces.GPU
98
  def generate(nfe: int, solver: str, phase: str, progress=gr.Progress()):
99
  model, lidar_utils, _ = torch.hub.load(config=model_dict[phase], **torch_hub_kwargs)
100
 
 
173
  return dropdown_solver, dropdown_nfe
174
 
175
 
176
+ with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  gr.HTML(DESCRIPTION)
178
 
179
  with gr.Row(variant="panel"):
 
206
 
207
 
208
  demo.queue()
209
+ demo.launch(
210
+ css="""
211
+ .head {
212
+ text-align: center;
213
+ display: block;
214
+ font-size: var(--text-xl);
215
+ }
216
+
217
+ .title {
218
+ font-size: var(--text-xxl);
219
+ font-weight: bold;
220
+ margin-top: 2rem;
221
+ }
222
+
223
+ .description {
224
+ font-size: var(--text-lg);
225
+ }
226
+ """,
227
+ theme=gr.themes.Ocean(),
228
+ )