Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,47 +4,11 @@ import google.generativeai as genai
|
|
4 |
import json
|
5 |
import random
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
'
|
10 |
-
'title': 'Emotionally Aware Chatbot',
|
11 |
-
'input_placeholder': 'Enter your message:',
|
12 |
-
'emotions_header': 'Detected Emotions:',
|
13 |
-
'response_header': 'AI Response:'
|
14 |
-
},
|
15 |
-
'Arabic': {
|
16 |
-
'title': 'روبوت الدردشة العاطفي',
|
17 |
-
'input_placeholder': 'أدخل رسالتك:',
|
18 |
-
'emotions_header': 'العواطف المكتشفة:',
|
19 |
-
'response_header': 'استجابة الذكاء الاصطناعي:'
|
20 |
-
},
|
21 |
-
'French': {
|
22 |
-
'title': 'Chatbot Émotionnel',
|
23 |
-
'input_placeholder': 'Entrez votre message:',
|
24 |
-
'emotions_header': 'Émotions Détectées:',
|
25 |
-
'response_header': 'Réponse IA:'
|
26 |
-
},
|
27 |
-
'Spanish': {
|
28 |
-
'title': 'Chatbot Emocional',
|
29 |
-
'input_placeholder': 'Introduzca su mensaje:',
|
30 |
-
'emotions_header': 'Emociones Detectadas:',
|
31 |
-
'response_header': 'Respuesta de IA:'
|
32 |
-
},
|
33 |
-
'Dutch': {
|
34 |
-
'title': 'Emotioneel Chatbot',
|
35 |
-
'input_placeholder': 'Voer uw bericht in:',
|
36 |
-
'emotions_header': 'Gedetecteerde Emoties:',
|
37 |
-
'response_header': 'AI-Antwoord:'
|
38 |
-
},
|
39 |
-
'Turkish': {
|
40 |
-
'title': 'Duygusal Sohbet Robotu',
|
41 |
-
'input_placeholder': 'Mesajınızı girin:',
|
42 |
-
'emotions_header': 'Algılanan Duygular:',
|
43 |
-
'response_header': 'Yapay Zeka Yanıtı:'
|
44 |
-
}
|
45 |
-
}
|
46 |
|
47 |
-
# Load the JSON data
|
48 |
with open('emotion_templates.json', 'r') as f:
|
49 |
data = json.load(f)
|
50 |
|
@@ -114,6 +78,10 @@ def main():
|
|
114 |
index=0 # Default to English
|
115 |
)
|
116 |
|
|
|
|
|
|
|
|
|
117 |
# Set page title and header based on selected language
|
118 |
st.title(LANGUAGES[selected_language]['title'])
|
119 |
|
|
|
4 |
import json
|
5 |
import random
|
6 |
|
7 |
+
# Load language configurations from JSON
|
8 |
+
with open('languages_config.json', 'r', encoding='utf-8') as f:
|
9 |
+
LANGUAGES = json.load(f)['LANGUAGES']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
# Load the JSON data for emotion templates
|
12 |
with open('emotion_templates.json', 'r') as f:
|
13 |
data = json.load(f)
|
14 |
|
|
|
78 |
index=0 # Default to English
|
79 |
)
|
80 |
|
81 |
+
# Display Image
|
82 |
+
st.image('chatBot_image.jpg', width=250, use_column_width=False,
|
83 |
+
output_format='PNG', channels='RGB')
|
84 |
+
|
85 |
# Set page title and header based on selected language
|
86 |
st.title(LANGUAGES[selected_language]['title'])
|
87 |
|