File size: 826 Bytes
b5cfbcf
 
 
 
3c4eca6
 
 
 
 
b5cfbcf
3c4eca6
 
b5cfbcf
 
3c4eca6
 
b5cfbcf
3c4eca6
 
 
 
 
b5cfbcf
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy
import gradio
from huggingface_hub import from_pretrained_keras

S = 5
N = 1000
D = 3
F = 64
G = 32

analysis_network = from_pretrained_keras("cmudrc/wave-energy-analysis")
synthesis_network = from_pretrained_keras("cmudrc/wave-energy-synthesis")
   
with gradio.Blocks() as demo:
    geometry = gradio.Textbox(label="geometry")     
    spectrum = gradio.Textbox(label="spectrum")

    analyze_it = gradio.Button("Analyze")
    synthesize_it = gradio.Button("Synthesize")
    
    analyze_it.click(fn=lambda x: numpy.array2string(analysis_network.predict(numpy.array(x))), inputs=[geometry], outputs=[spectrum], api_name="analyze")
    synthesize_it.click(fn=lambda x: numpy.array2string(synthesis_network.predict(numpy.array(x))), inputs=[spectrum], outputs=[geometry], api_name="synthesize")
    
demo.launch()