joermd commited on
Commit
12a11fb
·
verified ·
1 Parent(s): 4c66f71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +74 -7
app.py CHANGED
@@ -92,20 +92,87 @@ st.markdown("""
92
  <link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap" rel="stylesheet">
93
  """, unsafe_allow_html=True)
94
 
 
95
  # تحسين تحميل الرسوم المتحركة
96
  def load_lottieurl(url):
97
  try:
98
  r = requests.get(url)
99
  if r.status_code == 200:
100
  return r.json()
101
- except:
102
- pass
103
- return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- # تحميل الرسوم المتحركة المختلفة
106
- lottie_analyzing = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_qpwbqki6.json")
107
- lottie_success = load_lottieurl("https://assets9.lottiefiles.com/packages/lf20_jbrw3hcz.json")
108
- lottie_error = load_lottieurl("https://assets8.lottiefiles.com/packages/lf20_my7r4w9m.json")
 
 
109
 
110
  class WebsiteAnalyzer:
111
  def __init__(self):
 
92
  <link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap" rel="stylesheet">
93
  """, unsafe_allow_html=True)
94
 
95
+ # تحسين تحميل الرسوم المتحركة
96
  # تحسين تحميل الرسوم المتحركة
97
  def load_lottieurl(url):
98
  try:
99
  r = requests.get(url)
100
  if r.status_code == 200:
101
  return r.json()
102
+ except Exception as e:
103
+ print(f"Error loading Lottie animation: {e}")
104
+
105
+ # محتوى Lottie احتياطي بسيط
106
+ return {
107
+ "v": "5.5.7",
108
+ "fr": 60,
109
+ "ip": 0,
110
+ "op": 180,
111
+ "w": 512,
112
+ "h": 512,
113
+ "nm": "Loading Animation",
114
+ "ddd": 0,
115
+ "assets": [],
116
+ "layers": [{
117
+ "ddd": 0,
118
+ "ind": 1,
119
+ "ty": 4,
120
+ "nm": "Circle",
121
+ "sr": 1,
122
+ "ks": {
123
+ "o": {"a": 0, "k": 100},
124
+ "r": {
125
+ "a": 1,
126
+ "k": [{
127
+ "i": {"x": [0.833], "y": [0.833]},
128
+ "o": {"x": [0.167], "y": [0.167]},
129
+ "t": 0,
130
+ "s": [0]
131
+ }, {
132
+ "t": 180,
133
+ "s": [360]
134
+ }]
135
+ },
136
+ "p": {"a": 0, "k": [256, 256, 0]},
137
+ "a": {"a": 0, "k": [0, 0, 0]},
138
+ "s": {"a": 0, "k": [100, 100, 100]}
139
+ },
140
+ "ao": 0,
141
+ "shapes": [{
142
+ "ty": "gr",
143
+ "it": [{
144
+ "ty": "rc",
145
+ "d": 1,
146
+ "s": {"a": 0, "k": [100, 100]},
147
+ "p": {"a": 0, "k": [0, 0]},
148
+ "r": {"a": 0, "k": 50}
149
+ }],
150
+ "nm": "Rectangle",
151
+ "np": 2,
152
+ "cix": 2,
153
+ "bm": 0,
154
+ "ix": 1,
155
+ "mn": "ADBE Vector Group",
156
+ "hd": false
157
+ }],
158
+ "ip": 0,
159
+ "op": 180,
160
+ "st": 0,
161
+ "bm": 0
162
+ }]
163
+ }
164
+
165
+ # تحديث روابط الرسوم المتحركة لتكون أكثر موثوقية
166
+ lottie_analyzing = load_lottieurl("https://lottie.host/2c271015-5ef5-443c-9c4a-06ac803571fd/xEFNOVJ1lL.json")
167
+ lottie_success = load_lottieurl("https://lottie.host/cafd92b4-3389-441d-8b7c-ad0e178c870c/xYJdvN5QVb.json")
168
+ lottie_error = load_lottieurl("https://lottie.host/f93ea5d8-4452-4c7a-8965-4b3ccb28661c/H6l1LgXKrK.json")
169
 
170
+ # اضافة التحقق قبل استخدام الرسوم المتحركة
171
+ def show_lottie_animation(lottie_data, height=200):
172
+ if lottie_data:
173
+ st_lottie(lottie_data, height=height)
174
+ else:
175
+ st.warning("Could not load animation")
176
 
177
  class WebsiteAnalyzer:
178
  def __init__(self):