Spaces:
Running
Running
wissamantoun
commited on
Commit
·
50f2d4b
1
Parent(s):
2898bfd
fixes
Browse files- backend/qa.py +2 -1
- backend/services.py +16 -13
backend/qa.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
from qa_utils import annotate_answer
|
|
|
4 |
|
5 |
|
6 |
def write():
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
from .qa_utils import annotate_answer
|
4 |
+
from .services import get_qa_answers
|
5 |
|
6 |
|
7 |
def write():
|
backend/services.py
CHANGED
@@ -1,28 +1,31 @@
|
|
1 |
import json
|
|
|
2 |
import os
|
|
|
3 |
from typing import List
|
4 |
-
import
|
|
|
5 |
import more_itertools
|
6 |
import pandas as pd
|
7 |
import requests
|
8 |
-
from tqdm.auto import tqdm
|
9 |
-
from transformers import GPT2LMHeadModel, GPT2Tokenizer, pipeline, set_seed
|
10 |
-
|
11 |
-
from .modeling_gpt2 import GPT2LMHeadModel as GROVERLMHeadModel
|
12 |
-
from .preprocess import ArabertPreprocessor
|
13 |
-
from .sa_utils import *
|
14 |
-
from .utils import download_models, softmax
|
15 |
-
|
16 |
-
from functools import lru_cache
|
17 |
-
from urllib.parse import unquote
|
18 |
-
|
19 |
import streamlit as st
|
20 |
import wikipedia
|
21 |
from codetiming import Timer
|
22 |
from fuzzysearch import find_near_matches
|
23 |
from googleapi import google
|
24 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
|
|
|
|
|
|
|
|
26 |
|
27 |
logger = logging.getLogger(__name__)
|
28 |
# Taken and Modified from https://huggingface.co/spaces/flax-community/chef-transformer/blob/main/app.py
|
|
|
1 |
import json
|
2 |
+
import logging
|
3 |
import os
|
4 |
+
from functools import lru_cache
|
5 |
from typing import List
|
6 |
+
from urllib.parse import unquote
|
7 |
+
|
8 |
import more_itertools
|
9 |
import pandas as pd
|
10 |
import requests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
import streamlit as st
|
12 |
import wikipedia
|
13 |
from codetiming import Timer
|
14 |
from fuzzysearch import find_near_matches
|
15 |
from googleapi import google
|
16 |
+
from tqdm.auto import tqdm
|
17 |
+
from transformers import (
|
18 |
+
AutoTokenizer,
|
19 |
+
GPT2LMHeadModel,
|
20 |
+
GPT2Tokenizer,
|
21 |
+
pipeline,
|
22 |
+
set_seed,
|
23 |
+
)
|
24 |
|
25 |
+
from .modeling_gpt2 import GPT2LMHeadModel as GROVERLMHeadModel
|
26 |
+
from .preprocess import ArabertPreprocessor
|
27 |
+
from .sa_utils import *
|
28 |
+
from .utils import download_models, softmax
|
29 |
|
30 |
logger = logging.getLogger(__name__)
|
31 |
# Taken and Modified from https://huggingface.co/spaces/flax-community/chef-transformer/blob/main/app.py
|