SonicMaster / app.py
ambujm22's picture
Update app.py
ed317eb verified
raw
history blame
715 Bytes
# ---------- Gradio Space entrypoint (no FastAPI/Uvicorn) ----------
import os
os.environ.setdefault("GRADIO_USE_CDN", "true")
import gradio as gr
# (Optional) ZeroGPU probe — harmless on CPU. Will work once you switch HW to ZeroGPU.
try:
import spaces
@spaces.GPU(duration=10)
def gpu_probe(a: int = 1, b: int = 1):
return a + b
except Exception:
pass
with gr.Blocks(title="Hello Space") as demo:
gr.Markdown("### ✅ App is alive\nType to echo.")
inp = gr.Textbox(label="Input", value="hello")
out = gr.Textbox(label="Output")
inp.submit(lambda s: f"echo: {s}", inp, out)
# IMPORTANT: expose a top-level `demo`, and DO NOT call .launch()
demo = demo.queue(max_size=8)