Spaces:
Sleeping
Sleeping
Commit
•
e298c65
1
Parent(s):
e838258
add space decorator to run func
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import os
|
2 |
|
3 |
import gradio as gr
|
@@ -5,7 +7,7 @@ import gradio as gr
|
|
5 |
|
6 |
log_file = "out-file.txt"
|
7 |
|
8 |
-
|
9 |
def run():
|
10 |
import subprocess
|
11 |
import sys
|
@@ -19,10 +21,7 @@ def run():
|
|
19 |
content = ""
|
20 |
|
21 |
for line in iter(process.stdout.readline, ""):
|
22 |
-
content
|
23 |
-
content.append(line.decode("utf-8"))
|
24 |
-
content = content[-10:]
|
25 |
-
content = "\n".join(content)
|
26 |
yield content
|
27 |
|
28 |
|
|
|
1 |
+
import spaces
|
2 |
+
|
3 |
import os
|
4 |
|
5 |
import gradio as gr
|
|
|
7 |
|
8 |
log_file = "out-file.txt"
|
9 |
|
10 |
+
@spaces.GPU(duration=120)
|
11 |
def run():
|
12 |
import subprocess
|
13 |
import sys
|
|
|
21 |
content = ""
|
22 |
|
23 |
for line in iter(process.stdout.readline, ""):
|
24 |
+
content += line.decode("utf-8") + "\n"
|
|
|
|
|
|
|
25 |
yield content
|
26 |
|
27 |
|