Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,37 @@ subprocess.run('wget https://dl.google.com/linux/direct/google-chrome-stable_cur
|
|
41 |
|
42 |
subprocess.run('dpkg -i google-chrome-stable_current_amd64.deb', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
43 |
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
torch.set_default_device('cuda')
|
47 |
|
|
|
41 |
|
42 |
subprocess.run('dpkg -i google-chrome-stable_current_amd64.deb', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
43 |
|
44 |
+
subprocess.run('apt-get install wkhtmltopdf', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
45 |
+
|
46 |
+
subprocess.run('apt-get install xvfb', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
47 |
+
|
48 |
+
|
49 |
+
import imgkit
|
50 |
+
|
51 |
+
imgkit.from_string("""
|
52 |
+
<html>
|
53 |
+
<head>
|
54 |
+
<meta charset="utf-8">
|
55 |
+
</head>
|
56 |
+
<body>
|
57 |
+
<table border="1" cellspacing="0" cellpadding="8" style="font-family:'Noto Sans'; font-size:12px; border-collapse: collapse;">
|
58 |
+
<tr>
|
59 |
+
<th colspan="4" style="text-align:center; font-size:14px; padding:10px;">
|
60 |
+
Top hidden tokens per layer for the Prediction
|
61 |
+
</th>
|
62 |
+
</tr>
|
63 |
+
<tr>
|
64 |
+
<th>Layer ⬆️</th>
|
65 |
+
<th>Top 1</th>
|
66 |
+
<th>Top 2</th>
|
67 |
+
<th>Top 3</th>
|
68 |
+
</tr>
|
69 |
+
</table>
|
70 |
+
</body>
|
71 |
+
</html>
|
72 |
+
""", 'out.jpg')
|
73 |
+
|
74 |
+
print(Image.open('out.jpg'))
|
75 |
|
76 |
torch.set_default_device('cuda')
|
77 |
|