Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import os
|
2 |
import matplotlib
|
|
|
3 |
os.environ['MPLCONFIGDIR'] = '/tmp'
|
|
|
4 |
import streamlit as st
|
5 |
import requests
|
6 |
import json
|
@@ -13,12 +15,7 @@ from PIL import Image
|
|
13 |
import plotly.graph_objects as go
|
14 |
import plotly.express as px
|
15 |
from streamlit_lottie import st_lottie
|
16 |
-
import requests
|
17 |
import random
|
18 |
-
import plotly.graph_objects as go
|
19 |
-
from streamlit_lottie import st_lottie
|
20 |
-
import os
|
21 |
-
|
22 |
|
23 |
# Configuration de la page
|
24 |
st.set_page_config(
|
@@ -28,6 +25,25 @@ st.set_page_config(
|
|
28 |
initial_sidebar_state="expanded"
|
29 |
)
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# Fonctions utilitaires
|
32 |
def call_api(text):
|
33 |
"""Appelle l'API NLU Darija et retourne le résultat"""
|
|
|
1 |
import os
|
2 |
import matplotlib
|
3 |
+
# This MUST be at the top, before any other matplotlib imports
|
4 |
os.environ['MPLCONFIGDIR'] = '/tmp'
|
5 |
+
|
6 |
import streamlit as st
|
7 |
import requests
|
8 |
import json
|
|
|
15 |
import plotly.graph_objects as go
|
16 |
import plotly.express as px
|
17 |
from streamlit_lottie import st_lottie
|
|
|
18 |
import random
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Configuration de la page
|
21 |
st.set_page_config(
|
|
|
25 |
initial_sidebar_state="expanded"
|
26 |
)
|
27 |
|
28 |
+
def load_lottieurl(url: str):
|
29 |
+
r = requests.get(url)
|
30 |
+
if r.status_code != 200:
|
31 |
+
return None
|
32 |
+
return r.json()
|
33 |
+
|
34 |
+
lottie_hello = load_lottieurl("https://assets9.lottiefiles.com/packages/lf20_x2oiatt4.json")
|
35 |
+
|
36 |
+
st_lottie(
|
37 |
+
lottie_hello,
|
38 |
+
speed=1,
|
39 |
+
reverse=False,
|
40 |
+
loop=True,
|
41 |
+
quality="low", # medium ; high
|
42 |
+
height=200,
|
43 |
+
width=200,
|
44 |
+
key=None,
|
45 |
+
)
|
46 |
+
|
47 |
# Fonctions utilitaires
|
48 |
def call_api(text):
|
49 |
"""Appelle l'API NLU Darija et retourne le résultat"""
|