Spaces:
Sleeping
Sleeping
add demo
Browse files- requirements.txt +8 -0
- reviews.bin +3 -0
- stats.bin +3 -0
- trans_cache.bin +3 -0
- utils.py +44 -0
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
scikit-learn==1.3.2
|
2 |
+
transformers
|
3 |
+
setfit
|
4 |
+
translators
|
5 |
+
plotly
|
6 |
+
spacy
|
7 |
+
https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.7.1/en_core_web_lg-3.7.1-py3-none-any.whl
|
8 |
+
st-annotated-text
|
reviews.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd80a16a2e8c19db8ccc2d877a79c90176faf9c3cc838186916f6caac2131c6e
|
3 |
+
size 337146
|
stats.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:227683684e9a075c1946f3afcb818dfa253063f5d94a325fe8b71c6102c2ecd5
|
3 |
+
size 2067611
|
trans_cache.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7a800771f400d07c6e0e1a0b145f79c6f145d1f43517aa89e5f42df7a2f9bcc6
|
3 |
+
size 218917
|
utils.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
import inspect
|
16 |
+
import textwrap
|
17 |
+
import plotly.graph_objects as go
|
18 |
+
|
19 |
+
import streamlit as st
|
20 |
+
|
21 |
+
|
22 |
+
def show_code(demo):
|
23 |
+
"""Showing the code of the demo."""
|
24 |
+
show_code = st.sidebar.checkbox("Show code", True)
|
25 |
+
if show_code:
|
26 |
+
# Showing the code of the demo.
|
27 |
+
st.markdown("## Code")
|
28 |
+
sourcelines, _ = inspect.getsourcelines(demo)
|
29 |
+
st.code(textwrap.dedent("".join(sourcelines[1:])))
|
30 |
+
|
31 |
+
def plotly_line_chart(data, columns, styles={}, yaxis={}, index_name=None, title=''):
|
32 |
+
fig = go.Figure()
|
33 |
+
for c in columns:
|
34 |
+
if c not in data:
|
35 |
+
continue
|
36 |
+
ls = styles[c] if c in styles else None
|
37 |
+
y = yaxis[c] if c in yaxis else 'y1'
|
38 |
+
fig.add_trace(
|
39 |
+
go.Scatter(x=data.index if index_name is None else data[index_name], y=data[c],
|
40 |
+
line=ls, yaxis=y, name=c),
|
41 |
+
)
|
42 |
+
fig.update_layout(title=go.layout.Title(text=title, xref='paper', x=0.35),
|
43 |
+
yaxis2=dict(side='right'))
|
44 |
+
st.plotly_chart(fig)
|