m7n commited on
Commit
bf4af03
·
verified ·
1 Parent(s): aa8c944

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -27,11 +27,12 @@ app.mount("/static", StaticFiles(directory="static"), name="static")
27
  # Tell Gradio which paths are allowed to be served
28
  os.environ["GRADIO_ALLOWED_PATHS"] = str(static_dir.resolve())
29
 
30
- @spaces.GPU(duration=60) # Specify GPU duration in seconds
31
  def process_text(text):
32
  """Example GPU function - in reality, this might be model inference"""
33
  return text.upper()
34
 
 
 
35
  def process_and_save(request: gr.Request, text):
36
  """Main processing function that handles tokens and calls GPU function"""
37
  # Get and decode the authentication token
@@ -68,10 +69,10 @@ with gr.Blocks() as demo:
68
  )
69
 
70
  # Mount Gradio app to FastAPI with SSR mode for Spaces
71
- app = gr.mount_gradio_app(app, demo, path="/", ssr_mode=True)
72
 
73
  # Run server
74
  if __name__ == "__main__":
75
  # Set SSR mode for Spaces
76
- os.environ["GRADIO_SSR_MODE"] = "True"
77
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
27
  # Tell Gradio which paths are allowed to be served
28
  os.environ["GRADIO_ALLOWED_PATHS"] = str(static_dir.resolve())
29
 
 
30
  def process_text(text):
31
  """Example GPU function - in reality, this might be model inference"""
32
  return text.upper()
33
 
34
+
35
+ @spaces.GPU(duration=60) # Specify GPU duration in seconds
36
  def process_and_save(request: gr.Request, text):
37
  """Main processing function that handles tokens and calls GPU function"""
38
  # Get and decode the authentication token
 
69
  )
70
 
71
  # Mount Gradio app to FastAPI with SSR mode for Spaces
72
+ app = gr.mount_gradio_app(app, demo, path="/", ssr_mode=False)
73
 
74
  # Run server
75
  if __name__ == "__main__":
76
  # Set SSR mode for Spaces
77
+ os.environ["GRADIO_SSR_MODE"] = "False"
78
  uvicorn.run(app, host="0.0.0.0", port=7860)