Spaces:
Runtime error
Runtime error
removed footer
Browse files
app.py
CHANGED
|
@@ -11,13 +11,13 @@ if __name__ == '__main__':
|
|
| 11 |
import gradio as gr
|
| 12 |
import os
|
| 13 |
|
| 14 |
-
device =
|
| 15 |
config_path = os.path.join('models_file', 'config.pth')
|
| 16 |
model_path = os.path.join('models_file', 'microsoft-deberta-base_0.9449373420387531_8_best.pth')
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained('models_file/tokenizer')
|
| 18 |
model = CustomModel(CFG, config_path=config_path, pretrained=False)
|
| 19 |
state = torch.load(model_path,
|
| 20 |
-
map_location=torch.device('
|
| 21 |
model.load_state_dict(state['model'])
|
| 22 |
|
| 23 |
def get_answer(context, feature):
|
|
@@ -65,6 +65,8 @@ if __name__ == '__main__':
|
|
| 65 |
title="Phrase Extraction",
|
| 66 |
article=article,
|
| 67 |
enable_queue=True,
|
| 68 |
-
cache_examples=False
|
|
|
|
|
|
|
| 69 |
|
| 70 |
app.launch()
|
|
|
|
| 11 |
import gradio as gr
|
| 12 |
import os
|
| 13 |
|
| 14 |
+
device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'
|
| 15 |
config_path = os.path.join('models_file', 'config.pth')
|
| 16 |
model_path = os.path.join('models_file', 'microsoft-deberta-base_0.9449373420387531_8_best.pth')
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained('models_file/tokenizer')
|
| 18 |
model = CustomModel(CFG, config_path=config_path, pretrained=False)
|
| 19 |
state = torch.load(model_path,
|
| 20 |
+
map_location=torch.device('cuda'))
|
| 21 |
model.load_state_dict(state['model'])
|
| 22 |
|
| 23 |
def get_answer(context, feature):
|
|
|
|
| 65 |
title="Phrase Extraction",
|
| 66 |
article=article,
|
| 67 |
enable_queue=True,
|
| 68 |
+
cache_examples=False,
|
| 69 |
+
css="footer {visibility: hidden}"
|
| 70 |
+
)
|
| 71 |
|
| 72 |
app.launch()
|