Test using a subprocess
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
# TODO: requirments.txt
|
| 2 |
import os
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
|
| 5 |
import datasets
|
|
@@ -186,6 +186,9 @@ with tab2:
|
|
| 186 |
progress_text = f"Performing inference on {len(sentences)} sentences..."
|
| 187 |
progress_bar = st.progress(0, text=progress_text)
|
| 188 |
|
|
|
|
|
|
|
|
|
|
| 189 |
predictions = []
|
| 190 |
for i, sentence in enumerate(sentences):
|
| 191 |
predictions.append(
|
|
@@ -195,7 +198,7 @@ with tab2:
|
|
| 195 |
min(i / len(sentences), 1),
|
| 196 |
text=progress_text,
|
| 197 |
)
|
| 198 |
-
print(f"{model_name} - Progress: {i
|
| 199 |
progress_bar.empty()
|
| 200 |
|
| 201 |
# Store the predictions in a private dataset
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
import subprocess
|
| 3 |
import streamlit as st
|
| 4 |
|
| 5 |
import datasets
|
|
|
|
| 186 |
progress_text = f"Performing inference on {len(sentences)} sentences..."
|
| 187 |
progress_bar = st.progress(0, text=progress_text)
|
| 188 |
|
| 189 |
+
subprocess.Popen(["python", "script.py"])
|
| 190 |
+
|
| 191 |
+
# TODO: Switch to stqdm
|
| 192 |
predictions = []
|
| 193 |
for i, sentence in enumerate(sentences):
|
| 194 |
predictions.append(
|
|
|
|
| 198 |
min(i / len(sentences), 1),
|
| 199 |
text=progress_text,
|
| 200 |
)
|
| 201 |
+
print(f"{model_name} - Progress: {i/len(sentences)}")
|
| 202 |
progress_bar.empty()
|
| 203 |
|
| 204 |
# Store the predictions in a private dataset
|
script.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
|
| 3 |
+
for i in range(1000):
|
| 4 |
+
time.sleep(1)
|
| 5 |
+
print(i)
|