Corelyn commited on
Commit
3b0be4a
·
verified ·
1 Parent(s): 2af8e30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -27
app.py CHANGED
@@ -3,8 +3,6 @@ import torch
3
  import torch.nn as nn
4
  from torchvision.utils import make_grid
5
  import gradio as gr
6
- from fastapi import FastAPI
7
- from fastapi.responses import JSONResponse
8
 
9
  # ------------------------
10
  # CONFIG
@@ -90,7 +88,7 @@ with gr.Blocks(title="KYO") as demo:
90
  gr.Image(value=LOGO_PATH, show_label=False, width=180)
91
 
92
  gr.Markdown("# KYO")
93
- gr.Markdown("Generate graffiti-style images using your trained PyTorch GAN.")
94
 
95
  with gr.Row():
96
  num_samples = gr.Slider(
@@ -115,28 +113,7 @@ with gr.Blocks(title="KYO") as demo:
115
  )
116
 
117
  # ------------------------
118
- # FastAPI app + cron endpoint
119
  # ------------------------
120
- app = FastAPI()
121
-
122
- @app.get("/cron")
123
- def cron():
124
- """Cron endpoint – just returns a message for now."""
125
- return JSONResponse({
126
- "ok": True,
127
- "message": "KYO cron endpoint is live"
128
- })
129
-
130
- @app.get("/health")
131
- def health():
132
- """Health check endpoint."""
133
- return JSONResponse({
134
- "status": "healthy",
135
- "device": DEVICE,
136
- "model_loaded": G is not None
137
- })
138
-
139
- # Mount Gradio app on FastAPI
140
- app = gr.mount_gradio_app(app, demo, path="/")
141
-
142
- # No uvicorn.run() needed; HF Spaces handles the server and port
 
3
  import torch.nn as nn
4
  from torchvision.utils import make_grid
5
  import gradio as gr
 
 
6
 
7
  # ------------------------
8
  # CONFIG
 
88
  gr.Image(value=LOGO_PATH, show_label=False, width=180)
89
 
90
  gr.Markdown("# KYO")
91
+ gr.Markdown("Generate graffiti-style images using PyTorch GAN.")
92
 
93
  with gr.Row():
94
  num_samples = gr.Slider(
 
113
  )
114
 
115
  # ------------------------
116
+ # Launch app
117
  # ------------------------
118
+ if __name__ == "__main__":
119
+ demo.launch()