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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -284,6 +284,23 @@ with gr.Blocks(css=css) as demo:
284
  outputs=[gr.File(label="Download PNG", file_count="single", file_types=[".png"])]
285
  )
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  if __name__ == "__main__":
288
  # Set port based on environment variable or default to 7860
289
  port = int(os.environ.get("PORT", 7860))
@@ -309,21 +326,4 @@ if __name__ == "__main__":
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
  )
 
284
  outputs=[gr.File(label="Download PNG", file_count="single", file_types=[".png"])]
285
  )
286
 
287
+ # Expose a programmatic API for external clients (like gr.Client)
288
+ api_interface = gr.Interface(
289
+ fn=generate_handwriting_wrapper,
290
+ inputs=[
291
+ gr.Textbox(label="Text"),
292
+ gr.Slider(minimum=0, maximum=12, step=1, value=9, label="Style"),
293
+ gr.Slider(minimum=0.5, maximum=1.0, step=0.05, value=0.75, label="Bias"),
294
+ gr.ColorPicker(label="Color", value="#000000"),
295
+ gr.Slider(minimum=1, maximum=4, step=0.5, value=2, label="Stroke Width"),
296
+ ],
297
+ outputs=[
298
+ gr.HTML(label="SVG Output"),
299
+ gr.Image(type="filepath", label="PNG Output"),
300
+ ],
301
+ api_name="/generate_handwriting_wrapper", # 👈 this registers the endpoint
302
+ title="Handwriting API Endpoint",
303
+ description="Programmatic access for handwriting generation."
304
  if __name__ == "__main__":
305
  # Set port based on environment variable or default to 7860
306
  port = int(os.environ.get("PORT", 7860))
 
326
  demo.launch(server_name="0.0.0.0", server_port=port)
327
  # --- Add this before the if __name__ == "__main__" section ---
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  )