Spaces:
Runtime error
Runtime error
File size: 838 Bytes
b5cfbcf 3c4eca6 b5cfbcf 3c4eca6 b5cfbcf 3c4eca6 b5cfbcf 3c4eca6 5205c26 6d76826 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: analysis_network.predict(numpy.fromstring(x, dtype=float)).tostring(), inputs=[geometry], outputs=[spectrum], api_name="analyze")
synthesize_it.click(fn=lambda x: synthesis_network.predict(numpy.fromstring(x, dtype=int)).tostring(), inputs=[spectrum], outputs=[geometry], api_name="synthesize")
demo.launch() |