wecnet-api / app.py
ccm's picture
Update app.py
3c4eca6
raw
history blame
826 Bytes
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()