Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,15 +37,18 @@ minimumGain = -45
|
|
| 37 |
maximumGain = -5
|
| 38 |
attenLimDB = 3
|
| 39 |
|
|
|
|
| 40 |
|
| 41 |
try:
|
| 42 |
raise(RuntimeError("Not an error"))
|
| 43 |
#device = xm.xla_device()
|
| 44 |
print("TPU is available.")
|
|
|
|
| 45 |
except RuntimeError as e:
|
| 46 |
print(f"TPU is not available: {e}")
|
| 47 |
# Fallback to CPU or other devices if needed
|
| 48 |
-
|
|
|
|
| 49 |
print(f"Using {device} instead.")
|
| 50 |
#device = xm.xla_device()
|
| 51 |
|
|
@@ -112,6 +115,8 @@ def processFile(filePath):
|
|
| 112 |
|
| 113 |
#st.set_page_config(layout="wide")
|
| 114 |
st.title("Lecturer Support Tool")
|
|
|
|
|
|
|
| 115 |
|
| 116 |
uploaded_file_paths = st.file_uploader("Upload an audio of classroom activity to analyze", accept_multiple_files=True)
|
| 117 |
|
|
|
|
| 37 |
maximumGain = -5
|
| 38 |
attenLimDB = 3
|
| 39 |
|
| 40 |
+
isGPU = False
|
| 41 |
|
| 42 |
try:
|
| 43 |
raise(RuntimeError("Not an error"))
|
| 44 |
#device = xm.xla_device()
|
| 45 |
print("TPU is available.")
|
| 46 |
+
isGPU = True
|
| 47 |
except RuntimeError as e:
|
| 48 |
print(f"TPU is not available: {e}")
|
| 49 |
# Fallback to CPU or other devices if needed
|
| 50 |
+
isGPU = torch.cuda.is_available()
|
| 51 |
+
device = torch.device("cuda" if isGPU else "cpu")
|
| 52 |
print(f"Using {device} instead.")
|
| 53 |
#device = xm.xla_device()
|
| 54 |
|
|
|
|
| 115 |
|
| 116 |
#st.set_page_config(layout="wide")
|
| 117 |
st.title("Lecturer Support Tool")
|
| 118 |
+
if not isGPU:
|
| 119 |
+
st.warning("TOOL CURRENTLY USING CPU, ANALYSIS EXTREMELY SLOW")
|
| 120 |
|
| 121 |
uploaded_file_paths = st.file_uploader("Upload an audio of classroom activity to analyze", accept_multiple_files=True)
|
| 122 |
|