Spaces:
Runtime error
Runtime error
Arthour
commited on
Commit
Β·
c9ac1af
1
Parent(s):
a8bec11
Dependencies fix
Browse files- app.py +14 -5
- {app β core}/__init__.py +0 -0
- {app β core}/classificator.py +1 -1
- {app β core}/models/__init__.py +0 -0
- {app β core}/models/request.py +0 -0
- settings.py +0 -11
app.py
CHANGED
@@ -5,12 +5,13 @@ from typing import Dict, Any, List
|
|
5 |
|
6 |
import gradio as gr
|
7 |
import spacy
|
|
|
8 |
from pony.orm import db_session
|
9 |
from spacy import displacy
|
10 |
|
11 |
-
from
|
12 |
-
from
|
13 |
-
from settings import
|
14 |
|
15 |
|
16 |
class Application:
|
@@ -80,12 +81,20 @@ class Application:
|
|
80 |
|
81 |
|
82 |
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
db.generate_mapping(create_tables=True)
|
84 |
application = Application(
|
85 |
classificator=Classificator(
|
86 |
config={
|
87 |
-
'auth_endpoint_token':
|
88 |
-
'endpoint_url':
|
89 |
}
|
90 |
),
|
91 |
options={"ents": ["Observation", "Evaluation"], "colors": {"Observation": "#9bddff", "Evaluation": "#f08080"}}
|
|
|
5 |
|
6 |
import gradio as gr
|
7 |
import spacy
|
8 |
+
import streamlit as st
|
9 |
from pony.orm import db_session
|
10 |
from spacy import displacy
|
11 |
|
12 |
+
from core.classificator import Classificator, Classification
|
13 |
+
from core.models.request import Request
|
14 |
+
from settings import db
|
15 |
|
16 |
|
17 |
class Application:
|
|
|
81 |
|
82 |
|
83 |
if __name__ == '__main__':
|
84 |
+
db.bind(
|
85 |
+
provider='postgres',
|
86 |
+
user=st.secrets['pg_user'],
|
87 |
+
password=st.secrets['pg_password'],
|
88 |
+
host=st.secrets['pg_host'],
|
89 |
+
port=st.secrets['pg_port'],
|
90 |
+
database=st.secrets['pg_database']
|
91 |
+
)
|
92 |
db.generate_mapping(create_tables=True)
|
93 |
application = Application(
|
94 |
classificator=Classificator(
|
95 |
config={
|
96 |
+
'auth_endpoint_token': st.secrets["auth_endpoint_token"],
|
97 |
+
'endpoint_url': st.secrets["endpoint_url"]
|
98 |
}
|
99 |
),
|
100 |
options={"ents": ["Observation", "Evaluation"], "colors": {"Observation": "#9bddff", "Evaluation": "#f08080"}}
|
{app β core}/__init__.py
RENAMED
File without changes
|
{app β core}/classificator.py
RENAMED
@@ -30,7 +30,7 @@ class Classificator:
|
|
30 |
"""
|
31 |
self._config = config
|
32 |
|
33 |
-
def classify(self, text: str) -> List[
|
34 |
raw_data = self.send_request(text)
|
35 |
return self.post_process(raw_data)
|
36 |
|
|
|
30 |
"""
|
31 |
self._config = config
|
32 |
|
33 |
+
def classify(self, text: str) -> List[Classification]:
|
34 |
raw_data = self.send_request(text)
|
35 |
return self.post_process(raw_data)
|
36 |
|
{app β core}/models/__init__.py
RENAMED
File without changes
|
{app β core}/models/request.py
RENAMED
File without changes
|
settings.py
CHANGED
@@ -1,14 +1,3 @@
|
|
1 |
-
import streamlit as st
|
2 |
from pony.orm import Database
|
3 |
|
4 |
db = Database()
|
5 |
-
db.bind(
|
6 |
-
provider='postgres',
|
7 |
-
user=st.secrets['pg_user'],
|
8 |
-
password=st.secrets['pg_password'],
|
9 |
-
host=st.secrets['pg_host'],
|
10 |
-
port=st.secrets['pg_port'],
|
11 |
-
database=st.secrets['pg_database']
|
12 |
-
)
|
13 |
-
AUTH_ENDPOINT_TOKEN = st.secrets["auth_endpoint_token"]
|
14 |
-
ENDPOINT_URL = st.secrets["endpoint_url"]
|
|
|
|
|
1 |
from pony.orm import Database
|
2 |
|
3 |
db = Database()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|