Spaces:
Sleeping
Sleeping
s-a-malik
commited on
Commit
·
bb01eaa
1
Parent(s):
4d82a8e
zerogpu
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from pathlib import Path
|
2 |
from typing import List, Optional, Tuple
|
3 |
|
|
|
4 |
import gradio as gr
|
5 |
import numpy as np
|
6 |
import torch
|
@@ -162,7 +163,7 @@ def calculate_surprisal_diff(
|
|
162 |
]
|
163 |
return diff_tokens2surprisal
|
164 |
|
165 |
-
|
166 |
def main(input_text: str) -> Tuple[str, str, str]:
|
167 |
mean_surprisal, char2surprisal = calculate_surprisals_by_character(
|
168 |
input_text, trained_model, tokenizer
|
|
|
1 |
from pathlib import Path
|
2 |
from typing import List, Optional, Tuple
|
3 |
|
4 |
+
import spaces
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
import torch
|
|
|
163 |
]
|
164 |
return diff_tokens2surprisal
|
165 |
|
166 |
+
@spaces.GPU
|
167 |
def main(input_text: str) -> Tuple[str, str, str]:
|
168 |
mean_surprisal, char2surprisal = calculate_surprisals_by_character(
|
169 |
input_text, trained_model, tokenizer
|