jwphantom commited on
Commit
6a47c59
1 Parent(s): c6cc79a

first commit

Browse files
Files changed (3) hide show
  1. .gitignore +4 -0
  2. app.py +106 -0
  3. requirements.txt +56 -0
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ .venv/
2
+ __pycache__/
3
+ .env
4
+ .DS_Store
app.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from streamlit_option_menu import option_menu
3
+ from dataclasses import dataclass
4
+
5
+ import google.generativeai as genai
6
+
7
+
8
+ # Configuration de la page
9
+ st.set_page_config(page_title="Application Avancée", layout="wide")
10
+
11
+
12
+ # Contenu de la navbar avec des icônes appropriées
13
+ selected = option_menu(
14
+ menu_title=None, # Aucun titre pour le menu
15
+ options=[
16
+ "Chatbot intelligent",
17
+ "Text to speech",
18
+ "Zero shot image classification",
19
+ "Image to text",
20
+ ],
21
+ icons=["robot", "volume-up", "camera", "file-text"], # Icônes pour chaque option
22
+ menu_icon="cast", # Icône du menu
23
+ default_index=0, # Option par défaut
24
+ orientation="horizontal",
25
+ ) # Orientation du menu
26
+
27
+
28
+ # Affichage du contenu basé sur le choix de la navbar avec st.markdown pour une meilleure intégration
29
+ if selected == "Chatbot intelligent":
30
+
31
+ # Affichage du titre et du message de bienvenue
32
+ st.markdown(
33
+ """
34
+ <div class='content'>
35
+ <h1>Chatbot intelligent</h1>
36
+ <p>Bienvenue dans la section Chatbot intelligent.</p>
37
+ </div>
38
+ """,
39
+ unsafe_allow_html=True,
40
+ )
41
+
42
+ genai.configure(api_key="AIzaSyDQ9e-O5oWqo-toEZN19y4zzp9A61oZpTU")
43
+
44
+ model = genai.GenerativeModel("gemini-pro")
45
+
46
+ @dataclass
47
+ class Message:
48
+ actor: str
49
+ payload: str
50
+
51
+ USER = "user"
52
+ ASSISTANT = "ai"
53
+ MESSAGES = "messages"
54
+
55
+ if MESSAGES not in st.session_state:
56
+ st.session_state[MESSAGES] = [
57
+ Message(actor=ASSISTANT, payload="Salut! Comment puis-je vous aider ? 😎")
58
+ ]
59
+
60
+ msg: Message
61
+ for msg in st.session_state[MESSAGES]:
62
+ st.chat_message(msg.actor).write(msg.payload)
63
+
64
+ prompt: str = st.chat_input("Enter a prompt here")
65
+
66
+ if prompt:
67
+ st.session_state[MESSAGES].append(Message(actor=USER, payload=prompt))
68
+ st.chat_message(USER).write(prompt)
69
+ generate = model.generate_content(prompt)
70
+ response: str = generate.text
71
+ st.session_state[MESSAGES].append(Message(actor=ASSISTANT, payload=response))
72
+ st.chat_message(ASSISTANT).write(response)
73
+
74
+
75
+ elif selected == "Text to speech":
76
+ st.markdown(
77
+ """
78
+ <div class='content'>
79
+ <h1>Text to speech</h1>
80
+ <p>Explorez notre fonctionnalité de conversion de texte en parole.</p>
81
+ </div>
82
+ """,
83
+ unsafe_allow_html=True,
84
+ )
85
+
86
+ elif selected == "Zero shot image classification":
87
+ st.markdown(
88
+ """
89
+ <div class='content'>
90
+ <h1>Zero shot image classification</h1>
91
+ <p>Découvrez la classification d'images avec zéro exemple.</p>
92
+ </div>
93
+ """,
94
+ unsafe_allow_html=True,
95
+ )
96
+
97
+ elif selected == "Image to text":
98
+ st.markdown(
99
+ """
100
+ <div class='content'>
101
+ <h1>Image to text</h1>
102
+ <p>Convertissez des images en texte grâce à notre outil.</p>
103
+ </div>
104
+ """,
105
+ unsafe_allow_html=True,
106
+ )
requirements.txt ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.2.0
2
+ annotated-types==0.6.0
3
+ attrs==23.2.0
4
+ blinker==1.7.0
5
+ cachetools==5.3.3
6
+ certifi==2024.2.2
7
+ charset-normalizer==3.3.2
8
+ click==8.1.7
9
+ gitdb==4.0.11
10
+ GitPython==3.1.42
11
+ google-ai-generativelanguage==0.4.0
12
+ google-api-core==2.17.1
13
+ google-auth==2.28.2
14
+ google-generativeai==0.4.0
15
+ googleapis-common-protos==1.63.0
16
+ grpcio==1.62.1
17
+ grpcio-status==1.62.1
18
+ idna==3.6
19
+ Jinja2==3.1.3
20
+ jsonschema==4.21.1
21
+ jsonschema-specifications==2023.12.1
22
+ markdown-it-py==3.0.0
23
+ MarkupSafe==2.1.5
24
+ mdurl==0.1.2
25
+ numpy==1.26.4
26
+ packaging==23.2
27
+ pandas==2.2.1
28
+ pillow==10.2.0
29
+ proto-plus==1.23.0
30
+ protobuf==4.25.3
31
+ pyarrow==15.0.1
32
+ pyasn1==0.5.1
33
+ pyasn1-modules==0.3.0
34
+ pydantic==2.6.3
35
+ pydantic_core==2.16.3
36
+ pydeck==0.8.1b0
37
+ Pygments==2.17.2
38
+ python-dateutil==2.9.0.post0
39
+ pytz==2024.1
40
+ referencing==0.33.0
41
+ requests==2.31.0
42
+ rich==13.7.1
43
+ rpds-py==0.18.0
44
+ rsa==4.9
45
+ six==1.16.0
46
+ smmap==5.0.1
47
+ streamlit==1.32.0
48
+ streamlit-option-menu==0.3.12
49
+ tenacity==8.2.3
50
+ toml==0.10.2
51
+ toolz==0.12.1
52
+ tornado==6.4
53
+ tqdm==4.66.2
54
+ typing_extensions==4.10.0
55
+ tzdata==2024.1
56
+ urllib3==2.2.1