m7n commited on
Commit
6db247f
·
verified ·
1 Parent(s): a02ee8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -27,7 +27,7 @@ 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()
@@ -45,12 +45,12 @@ def process_and_save(request: gr.Request, text):
45
  processed_text = process_text(text)
46
 
47
  # Save to file
48
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
49
- file_path = static_dir / f"output_{timestamp}.txt"
50
- with open(file_path, "w") as f:
51
- f.write(processed_text)
52
 
53
- return gr.File(value=file_path)
54
 
55
  # Mark main function as not requiring GPU
56
  process_and_save.zerogpu = True
 
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=4*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()
 
45
  processed_text = process_text(text)
46
 
47
  # Save to file
48
+ # timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
49
+ # file_path = static_dir / f"output_{timestamp}.txt"
50
+ # with open(file_path, "w") as f:
51
+ # f.write(processed_text)
52
 
53
+ # return gr.File(value=file_path)
54
 
55
  # Mark main function as not requiring GPU
56
  process_and_save.zerogpu = True