ccm commited on
Commit
7bca059
1 Parent(s): 95a591c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -10,6 +10,10 @@ class NumpyArrayEncoder(JSONEncoder):
10
  return obj.tolist()
11
  return JSONEncoder.default(self, obj)
12
 
 
 
 
 
13
  analysis_network = from_pretrained_keras("cmudrc/wave-energy-analysis")
14
  synthesis_network = from_pretrained_keras("cmudrc/wave-energy-synthesis")
15
 
@@ -20,7 +24,7 @@ with gradio.Blocks() as demo:
20
  analyze_it = gradio.Button("Analyze")
21
  synthesize_it = gradio.Button("Synthesize")
22
 
23
- analyze_it.click(fn=lambda x: json.dumps(analysis_network.predict(numpy.asarray(json.loads(x))), cls=NumpyArrayEncoder), inputs=[geometry], outputs=[spectrum], api_name="analyze")
24
- synthesize_it.click(fn=lambda x: json.dumps(synthesis_network.predict(numpy.asarray(json.loads(x))), cls=NumpyArrayEncoder), inputs=[spectrum], outputs=[geometry], api_name="synthesize")
25
 
26
  demo.launch()
 
10
  return obj.tolist()
11
  return JSONEncoder.default(self, obj)
12
 
13
+ def print_shape_through(x):
14
+ print(x.shape)
15
+ return x
16
+
17
  analysis_network = from_pretrained_keras("cmudrc/wave-energy-analysis")
18
  synthesis_network = from_pretrained_keras("cmudrc/wave-energy-synthesis")
19
 
 
24
  analyze_it = gradio.Button("Analyze")
25
  synthesize_it = gradio.Button("Synthesize")
26
 
27
+ analyze_it.click(fn=lambda x: json.dumps(analysis_network.predict(print_shape_through(numpy.asarray(json.loads(x)))), cls=NumpyArrayEncoder), inputs=[geometry], outputs=[spectrum], api_name="analyze")
28
+ synthesize_it.click(fn=lambda x: json.dumps(synthesis_network.predict(print_shape_through(numpy.asarray(json.loads(x)))), cls=NumpyArrayEncoder), inputs=[spectrum], outputs=[geometry], api_name="synthesize")
29
 
30
  demo.launch()