Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,6 +37,16 @@ import tempfile
|
|
| 37 |
import matplotlib.pyplot as plt
|
| 38 |
import seaborn as sns
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
# Positional Encoding Function
|
| 41 |
def positional_encoding(seq_len, d_model):
|
| 42 |
pos = tf.range(seq_len, dtype=tf.float32)[:, tf.newaxis]
|
|
|
|
| 37 |
import matplotlib.pyplot as plt
|
| 38 |
import seaborn as sns
|
| 39 |
|
| 40 |
+
import os
|
| 41 |
+
import tempfile
|
| 42 |
+
|
| 43 |
+
# Set a new temp directory inside /home/user
|
| 44 |
+
os.environ["GRADIO_CACHE"] = "/home/user/tmp"
|
| 45 |
+
tempfile.tempdir = "/home/user/tmp"
|
| 46 |
+
|
| 47 |
+
# Ensure the directory exists
|
| 48 |
+
os.makedirs(tempfile.tempdir, exist_ok=True)
|
| 49 |
+
|
| 50 |
# Positional Encoding Function
|
| 51 |
def positional_encoding(seq_len, d_model):
|
| 52 |
pos = tf.range(seq_len, dtype=tf.float32)[:, tf.newaxis]
|