3morrrrr commited on
Commit
653aa2b
·
verified ·
1 Parent(s): d5c46c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -306,4 +306,24 @@ if __name__ == "__main__":
306
  else:
307
  print("All required packages are installed and ready for transparent PNG export")
308
 
309
- demo.launch(server_name="0.0.0.0", server_port=port)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  else:
307
  print("All required packages are installed and ready for transparent PNG export")
308
 
309
+ demo.launch(server_name="0.0.0.0", server_port=port)
310
+ # --- Add this before the if __name__ == "__main__" section ---
311
+
312
+ # Expose a programmatic API for external clients (like gr.Client)
313
+ api_interface = gr.Interface(
314
+ fn=generate_handwriting_wrapper,
315
+ inputs=[
316
+ gr.Textbox(label="Text"),
317
+ gr.Slider(minimum=0, maximum=12, step=1, value=9, label="Style"),
318
+ gr.Slider(minimum=0.5, maximum=1.0, step=0.05, value=0.75, label="Bias"),
319
+ gr.ColorPicker(label="Color", value="#000000"),
320
+ gr.Slider(minimum=1, maximum=4, step=0.5, value=2, label="Stroke Width"),
321
+ ],
322
+ outputs=[
323
+ gr.HTML(label="SVG Output"),
324
+ gr.Image(type="filepath", label="PNG Output"),
325
+ ],
326
+ api_name="/generate_handwriting_wrapper", # 👈 this registers the endpoint
327
+ title="Handwriting API Endpoint",
328
+ description="Programmatic access for handwriting generation."
329
+ )