Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
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
|