Spaces:
Build error
Build error
Commit
·
c33e440
1
Parent(s):
bf6b2ab
fix tokenizer bug in LOREN; showing label in text-type: maybe a bug in spaces
Browse files- app.py +6 -3
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -13,6 +13,7 @@ from huggingface_hub import snapshot_download
|
|
| 13 |
from prettytable import PrettyTable
|
| 14 |
import pandas as pd
|
| 15 |
import torch
|
|
|
|
| 16 |
|
| 17 |
config = {
|
| 18 |
"model_type": "roberta",
|
|
@@ -105,9 +106,11 @@ def gradio_formatter(js, output_type):
|
|
| 105 |
def run(claim):
|
| 106 |
try:
|
| 107 |
js = loren.check(claim)
|
| 108 |
-
except Exception as
|
| 109 |
-
|
|
|
|
| 110 |
loren.logger.error(claim)
|
|
|
|
| 111 |
return 'Oops, something went wrong.', '', ''
|
| 112 |
label = js['claim_veracity']
|
| 113 |
loren.logger.warning(label + str(js))
|
|
@@ -120,7 +123,7 @@ iface = gr.Interface(
|
|
| 120 |
fn=run,
|
| 121 |
inputs="text",
|
| 122 |
outputs=[
|
| 123 |
-
'
|
| 124 |
'html',
|
| 125 |
'html',
|
| 126 |
],
|
|
|
|
| 13 |
from prettytable import PrettyTable
|
| 14 |
import pandas as pd
|
| 15 |
import torch
|
| 16 |
+
import traceback
|
| 17 |
|
| 18 |
config = {
|
| 19 |
"model_type": "roberta",
|
|
|
|
| 106 |
def run(claim):
|
| 107 |
try:
|
| 108 |
js = loren.check(claim)
|
| 109 |
+
except Exception as error_msg:
|
| 110 |
+
exc = traceback.format_exc()
|
| 111 |
+
msg = f'[Error]: {error_msg}.\n[Traceback]: {exc}'
|
| 112 |
loren.logger.error(claim)
|
| 113 |
+
loren.logger.error(msg)
|
| 114 |
return 'Oops, something went wrong.', '', ''
|
| 115 |
label = js['claim_veracity']
|
| 116 |
loren.logger.warning(label + str(js))
|
|
|
|
| 123 |
fn=run,
|
| 124 |
inputs="text",
|
| 125 |
outputs=[
|
| 126 |
+
'text',
|
| 127 |
'html',
|
| 128 |
'html',
|
| 129 |
],
|
requirements.txt
CHANGED
|
@@ -16,7 +16,7 @@ rouge_score
|
|
| 16 |
sacrebleu
|
| 17 |
tagme
|
| 18 |
wikipedia-api
|
| 19 |
-
gradio
|
| 20 |
tensorflow
|
| 21 |
pytorch-lightning==1.0.4
|
| 22 |
allennlp==1.2.2
|
|
|
|
| 16 |
sacrebleu
|
| 17 |
tagme
|
| 18 |
wikipedia-api
|
| 19 |
+
gradio
|
| 20 |
tensorflow
|
| 21 |
pytorch-lightning==1.0.4
|
| 22 |
allennlp==1.2.2
|