Update app.py
Browse files
app.py
CHANGED
@@ -13,13 +13,13 @@ image_processor = AutoImageProcessor.from_pretrained(image_model_name)
|
|
13 |
image_model = AutoModelForImageClassification.from_pretrained(image_model_name)
|
14 |
|
15 |
islamic_advice = {
|
16 |
-
"sadness": "<h1 class='emoji'>๐ข</h1><div class='notion-card'><h3>Sadness</h3><p><strong>โDo not grieve; indeed Allah is with us.โ</strong><br><span class='arabic'>ููุง ุชูุญูุฒููู ุฅูููู ุงูููููู ู
ูุนูููุง</span><br><em>Qur'an, At-Tawbah 9:40</em></p></div>",
|
17 |
-
"joy": "<h1 class='emoji'>๐</h1><div class='notion-card'><h3>Joy</h3><p><strong>โIf you are grateful, I will surely increase your favor.โ</strong><br><span class='arabic'>ููุฆูู ุดูููุฑูุชูู
ู ููุฃูุฒููุฏููููููู
ู</span><br><em>Qur'an, Ibrahim 14:7</em></p></div>",
|
18 |
-
"fear": "<h1 class='emoji'>๐ฑ</h1><div class='notion-card'><h3>Fear</h3><p><strong>โSufficient for us is Allah, and [He is] the best Disposer of affairs.โ</strong><br><span class='arabic'>ุญูุณูุจูููุง ุงูููููู ููููุนูู
ู ุงููููููููู</span><br><em>Qur'an, Al Imran 3:173</em></p></div>",
|
19 |
-
"anger": "<h1 class='emoji'>๐ก</h1><div class='notion-card'><h3>Anger</h3><p><strong>โThe strong is not the one who overcomes people by his strength, but the strong is the one who controls himself while in anger.โ</strong><br><em>Hadith, Sahih al-Bukhari 6114</em></p></div>",
|
20 |
-
"confusion": "<h1 class='emoji'>๐ค</h1><div class='notion-card'><h3>Confusion</h3><p><strong>โSeek help through patience and prayer.โ</strong><br><span class='arabic'>ููุงุณูุชูุนูููููุง ุจูุงูุตููุจูุฑู ููุงูุตููููุงุฉู</span><br><em>Qur'an, Al-Baqarah 2:45</em></p></div>",
|
21 |
-
"love": "<h1 class='emoji'>โค๏ธ</h1><div class='notion-card'><h3>Love</h3><p><strong>โIndeed, those who have believed and done righteous deeds - the Most Merciful will appoint for them affection.โ</strong><br><span class='arabic'>ุณูููุฌูุนููู ููููู
ู ุงูุฑููุญูู
ููฐูู ููุฏููุง</span><br><em>Qur'an, Maryam 19:96</em></p></div>",
|
22 |
-
"neutral": "<h1 class='emoji'>๐</h1><div class='notion-card'><h3>Neutral</h3><p><strong>May Allah always guide your heart in every situation.</strong></p></div>"
|
23 |
}
|
24 |
|
25 |
def analyze_combined(text, threshold, image):
|
@@ -57,6 +57,7 @@ body {
|
|
57 |
border-radius: 8px !important;
|
58 |
font-weight: 600;
|
59 |
padding: 10px 20px;
|
|
|
60 |
}
|
61 |
.gr-button:hover {
|
62 |
background-color: #2563eb !important;
|
@@ -67,10 +68,11 @@ body {
|
|
67 |
border: 1px solid #e5e7eb;
|
68 |
padding: 16px;
|
69 |
margin-top: 12px;
|
70 |
-
box-shadow: 0
|
71 |
max-width: 600px;
|
72 |
margin-left: auto;
|
73 |
margin-right: auto;
|
|
|
74 |
}
|
75 |
.notion-card h3 {
|
76 |
margin-top: 0;
|
@@ -89,6 +91,7 @@ body {
|
|
89 |
font-size: 3rem;
|
90 |
margin: 0;
|
91 |
padding: 0;
|
|
|
92 |
}
|
93 |
.arabic {
|
94 |
font-size: 1.3rem;
|
@@ -99,6 +102,26 @@ body {
|
|
99 |
text-align: right;
|
100 |
font-family: 'Scheherazade', serif;
|
101 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
"""
|
103 |
|
104 |
demo = gr.Interface(
|
|
|
13 |
image_model = AutoModelForImageClassification.from_pretrained(image_model_name)
|
14 |
|
15 |
islamic_advice = {
|
16 |
+
"sadness": "<h1 class='emoji'>๐ข</h1><div class='notion-card animated'><h3>Sadness</h3><p><strong>โDo not grieve; indeed Allah is with us.โ</strong><br><span class='arabic'>ููุง ุชูุญูุฒููู ุฅูููู ุงูููููู ู
ูุนูููุง</span><br><em>Qur'an, At-Tawbah 9:40</em></p></div>",
|
17 |
+
"joy": "<h1 class='emoji'>๐</h1><div class='notion-card animated'><h3>Joy</h3><p><strong>โIf you are grateful, I will surely increase your favor.โ</strong><br><span class='arabic'>ููุฆูู ุดูููุฑูุชูู
ู ููุฃูุฒููุฏููููููู
ู</span><br><em>Qur'an, Ibrahim 14:7</em></p></div>",
|
18 |
+
"fear": "<h1 class='emoji'>๐ฑ</h1><div class='notion-card animated'><h3>Fear</h3><p><strong>โSufficient for us is Allah, and [He is] the best Disposer of affairs.โ</strong><br><span class='arabic'>ุญูุณูุจูููุง ุงูููููู ููููุนูู
ู ุงููููููููู</span><br><em>Qur'an, Al Imran 3:173</em></p></div>",
|
19 |
+
"anger": "<h1 class='emoji'>๐ก</h1><div class='notion-card animated'><h3>Anger</h3><p><strong>โThe strong is not the one who overcomes people by his strength, but the strong is the one who controls himself while in anger.โ</strong><br><em>Hadith, Sahih al-Bukhari 6114</em></p></div>",
|
20 |
+
"confusion": "<h1 class='emoji'>๐ค</h1><div class='notion-card animated'><h3>Confusion</h3><p><strong>โSeek help through patience and prayer.โ</strong><br><span class='arabic'>ููุงุณูุชูุนูููููุง ุจูุงูุตููุจูุฑู ููุงูุตููููุงุฉู</span><br><em>Qur'an, Al-Baqarah 2:45</em></p></div>",
|
21 |
+
"love": "<h1 class='emoji'>โค๏ธ</h1><div class='notion-card animated'><h3>Love</h3><p><strong>โIndeed, those who have believed and done righteous deeds - the Most Merciful will appoint for them affection.โ</strong><br><span class='arabic'>ุณูููุฌูุนููู ููููู
ู ุงูุฑููุญูู
ููฐูู ููุฏููุง</span><br><em>Qur'an, Maryam 19:96</em></p></div>",
|
22 |
+
"neutral": "<h1 class='emoji'>๐</h1><div class='notion-card animated'><h3>Neutral</h3><p><strong>May Allah always guide your heart in every situation.</strong></p></div>"
|
23 |
}
|
24 |
|
25 |
def analyze_combined(text, threshold, image):
|
|
|
57 |
border-radius: 8px !important;
|
58 |
font-weight: 600;
|
59 |
padding: 10px 20px;
|
60 |
+
transition: background-color 0.3s ease;
|
61 |
}
|
62 |
.gr-button:hover {
|
63 |
background-color: #2563eb !important;
|
|
|
68 |
border: 1px solid #e5e7eb;
|
69 |
padding: 16px;
|
70 |
margin-top: 12px;
|
71 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.05);
|
72 |
max-width: 600px;
|
73 |
margin-left: auto;
|
74 |
margin-right: auto;
|
75 |
+
animation: fadeInUp 0.6s ease-out;
|
76 |
}
|
77 |
.notion-card h3 {
|
78 |
margin-top: 0;
|
|
|
91 |
font-size: 3rem;
|
92 |
margin: 0;
|
93 |
padding: 0;
|
94 |
+
animation: popIn 0.5s ease;
|
95 |
}
|
96 |
.arabic {
|
97 |
font-size: 1.3rem;
|
|
|
102 |
text-align: right;
|
103 |
font-family: 'Scheherazade', serif;
|
104 |
}
|
105 |
+
@keyframes fadeInUp {
|
106 |
+
0% {
|
107 |
+
opacity: 0;
|
108 |
+
transform: translateY(20px);
|
109 |
+
}
|
110 |
+
100% {
|
111 |
+
opacity: 1;
|
112 |
+
transform: translateY(0);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
@keyframes popIn {
|
116 |
+
0% {
|
117 |
+
transform: scale(0.5);
|
118 |
+
opacity: 0;
|
119 |
+
}
|
120 |
+
100% {
|
121 |
+
transform: scale(1);
|
122 |
+
opacity: 1;
|
123 |
+
}
|
124 |
+
}
|
125 |
"""
|
126 |
|
127 |
demo = gr.Interface(
|