Ben Burtenshaw commited on
Commit
7819f64
2 Parent(s): 956b1a1 d3d5007

Merge branch 'main' of https://huggingface.co/spaces/burtenshaw/disticleaner

Browse files
Files changed (1) hide show
  1. app.py +8 -10
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
- with open("out-file.txt", "w") as f:
14
- process = subprocess.Popen(
15
- [f"{sys.executable}", "prometheus_pipeline.py"],
16
- stdout=subprocess.PIPE,
17
- )
18
 
19
  content = ""
20
 
21
  for line in iter(process.stdout.readline, ""):
22
- content = content.split("\n")
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