Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/burtenshaw/disticleaner
Browse files
app.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
import gradio as gr
|
|
@@ -5,24 +7,20 @@ import gradio as gr
|
|
| 5 |
|
| 6 |
log_file = "out-file.txt"
|
| 7 |
|
| 8 |
-
|
| 9 |
def run():
|
| 10 |
import subprocess
|
| 11 |
import sys
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
)
|
| 18 |
|
| 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
|
| 14 |
|
| 15 |
+
process = subprocess.Popen(
|
| 16 |
+
[f"{sys.executable}", "prometheus_pipeline.py"],
|
| 17 |
+
stdout=subprocess.PIPE,
|
| 18 |
+
)
|
|
|
|
| 19 |
|
| 20 |
content = ""
|
| 21 |
|
| 22 |
for line in iter(process.stdout.readline, ""):
|
| 23 |
+
content += line.decode("utf-8") + "\n"
|
|
|
|
|
|
|
|
|
|
| 24 |
yield content
|
| 25 |
|
| 26 |
|