nekofura commited on
Commit
d38e23d
1 Parent(s): 634c920

Upload inference.py

Browse files
Files changed (1) hide show
  1. inference.py +7 -4
inference.py CHANGED
@@ -9,6 +9,8 @@ from io import BytesIO
9
  import threading
10
  import queue
11
 
 
 
12
  app = FastAPI()
13
 
14
  # Set up CORS
@@ -50,8 +52,7 @@ def generate(
50
  seed: int = Body(default=42),
51
  guidance_scale: float = Body(default=1.0),
52
  negative_prompt: str = Body(default=None),
53
- scheduler_type: str = Body(default="LCM"),
54
- use_karras_sigmas: bool = Body(default=False)
55
  ):
56
  if not prompt:
57
  raise HTTPException(status_code=400, detail="No prompt provided")
@@ -63,8 +64,7 @@ def generate(
63
  'seed': seed,
64
  'guidance_scale': guidance_scale,
65
  'negative_prompt': negative_prompt,
66
- 'scheduler_type': scheduler_type,
67
- 'use_karras_sigmas': use_karras_sigmas
68
  }))
69
 
70
  return {'request_id': request_id}
@@ -81,9 +81,12 @@ def get_status():
81
  return {'status': 'Server is running'}
82
 
83
  def start_ngrok():
 
 
84
  ngrok_tunnel = ngrok.connect(8000)
85
  print(' * Ngrok Tunnel URL:', ngrok_tunnel.public_url)
86
 
 
87
  if __name__ == '__main__':
88
  threading.Thread(target=process_request, daemon=True).start()
89
  threading.Thread(target=start_ngrok, daemon=True).start()
 
9
  import threading
10
  import queue
11
 
12
+ NGROK_AUTH_TOKEN = "2GSHB8Ao0IQGxmoaK2hHdbza9ON_5PpaRRiRw4CsZNsh4g8GN"
13
+
14
  app = FastAPI()
15
 
16
  # Set up CORS
 
52
  seed: int = Body(default=42),
53
  guidance_scale: float = Body(default=1.0),
54
  negative_prompt: str = Body(default=None),
55
+ scheduler_type: str = Body(default="LCM")
 
56
  ):
57
  if not prompt:
58
  raise HTTPException(status_code=400, detail="No prompt provided")
 
64
  'seed': seed,
65
  'guidance_scale': guidance_scale,
66
  'negative_prompt': negative_prompt,
67
+ 'scheduler_type': scheduler_type
 
68
  }))
69
 
70
  return {'request_id': request_id}
 
81
  return {'status': 'Server is running'}
82
 
83
  def start_ngrok():
84
+ ngrok.set_auth_token(NGROK_AUTH_TOKEN)
85
+
86
  ngrok_tunnel = ngrok.connect(8000)
87
  print(' * Ngrok Tunnel URL:', ngrok_tunnel.public_url)
88
 
89
+
90
  if __name__ == '__main__':
91
  threading.Thread(target=process_request, daemon=True).start()
92
  threading.Thread(target=start_ngrok, daemon=True).start()