abdeljalilELmajjodi commited on
Commit
3421713
·
verified ·
1 Parent(s): 9fd04d3

upload app

Browse files
Files changed (6) hide show
  1. agents.py +26 -0
  2. app.py +76 -0
  3. atlasia.txt +176 -0
  4. requirements.txt +3 -0
  5. retrieve.py +11 -0
  6. tools.py +35 -0
agents.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from smolagents import OpenAIServerModel,CodeAgent
3
+ from dotenv import load_dotenv
4
+ import os
5
+ from tools import AtlasiaHubInfoTool
6
+ from retrieve import about_atlasia
7
+
8
+
9
+ load_dotenv()
10
+
11
+ def init_model():
12
+ key=os.getenv("GOOGLE_API_KEY")
13
+ model=OpenAIServerModel(
14
+ api_base="https://generativelanguage.googleapis.com/v1beta",
15
+ api_key=key,
16
+ model_id="gemini-2.0-flash"
17
+ )
18
+ return model
19
+
20
+ def init_agent():
21
+ model=init_model()
22
+ agent=CodeAgent(
23
+ tools=[AtlasiaHubInfoTool(),about_atlasia],
24
+ model=model,
25
+ )
26
+ return agent
app.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from agents import init_agent
3
+
4
+ agent=init_agent()
5
+ def run_agent(query):
6
+ # Assuming the agent has a method to run a query
7
+ response=agent.run(query,reset=False)
8
+ if isinstance(response, list):
9
+ response="\n".join(response)
10
+ return response
11
+ query_input = gr.Textbox(
12
+ label="Query",
13
+ placeholder="Enter your query here...",
14
+ lines=3,
15
+ max_lines=5
16
+ )
17
+
18
+ output=gr.TextArea(
19
+ label="Response",
20
+ placeholder="The response will appear here...",
21
+ lines=10,
22
+ max_lines=20
23
+ )
24
+
25
+ demo = gr.Interface(
26
+ fn=run_agent,
27
+ inputs=query_input,
28
+ outputs=output,
29
+ title="AtlasIA Assistant",
30
+ description="Ask me anything and I'll help you find the information you need.",
31
+ theme=gr.themes.Soft(),
32
+ examples=[
33
+ ["names of datasets with image modality"],
34
+ ["what is the most 3 liked datasets"],
35
+ ["find the most downloaded model"],
36
+ ["Who are the members of Atlasia?"],
37
+ ["what is atlasIA community in 3 lines??"],
38
+ ["how i can join the community?"],
39
+ ["how i can contribute to the community?"]
40
+ ],
41
+ cache_examples=True,
42
+ flagging_mode="never",
43
+ css="""
44
+ .gradio-container {
45
+ max-width: 800px;
46
+ margin: auto;
47
+ }
48
+ .gradio-interface {
49
+ padding: 2rem;
50
+ }
51
+ .output-text {
52
+ white-space: pre-wrap;
53
+ font-family: 'Courier New', monospace;
54
+ background-color: #f5f5f5;
55
+ padding: 1rem;
56
+ border-radius: 5px;
57
+ border: 1px solid #ddd;
58
+ }
59
+ .input-text {
60
+ font-size: 1.1em;
61
+ }
62
+ .title {
63
+ font-size: 2em;
64
+ font-weight: bold;
65
+ margin-bottom: 1rem;
66
+ }
67
+ .description {
68
+ font-size: 1.2em;
69
+ color: #666;
70
+ margin-bottom: 2rem;
71
+ }
72
+ """
73
+ )
74
+ if __name__=="__main__":
75
+ # Initialize the agent
76
+ demo.launch()
atlasia.txt ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Building AI with Moroccan heritage
2
+
3
+ Join our community to help build language datasets and improve AI models for Darija.
4
+
5
+ Start reviewing
6
+
7
+ Review and rate the accuracy of Darija translations for various text data.
8
+
9
+ [Discover now](https://www.atlasia.ma/annotation)
10
+
11
+ Start recording
12
+
13
+ Record your voice in Darija to contribute to our audio collection.
14
+
15
+ [Discover now](https://www.atlasia.ma/recording)
16
+
17
+ Start annotating
18
+
19
+ Translate provided text data into Darija to help build our language dataset.
20
+
21
+ Coming soon...
22
+
23
+ About ATLASIA
24
+
25
+ ## Developing AI Models with Moroccan Identity
26
+
27
+ ATLASIA is an open-source initiative committed to developing AI models that resonate with Moroccan values, identity, and culture. Our user-friendly platform facilitates the collection and storage of data, ensuring it is accessible to the public to foster AI advancements in Morocco.
28
+
29
+ [Explore our models on Huggingface](https://huggingface.co/atlasia)
30
+
31
+ Who We Are
32
+
33
+ ## Our Teams
34
+
35
+ Bringing together diverse expertise to build AI solutions that reflect Moroccan culture and values.
36
+
37
+ Co-Founders
38
+
39
+ Working together to build ATLASIA
40
+
41
+ AtlasIA emerged from the shared vision of four individuals passionate about AI projects relevant to the Moroccan culture. Their collaborative efforts led to the establishment of AtlasIA as an open-source project dedicated to developing culturally attuned AI models.
42
+
43
+ Web Development Team
44
+
45
+ Working together to build ATLASIA
46
+
47
+ The WebDev Team is responsible for AtlasIA's digital presence, creating a sleek, user-friendly website and an innovative annotation platform. They consistently deliver high-quality digital solutions that enhance the user experience.
48
+
49
+ Data Team
50
+
51
+ Working together to build ATLASIA
52
+
53
+ The Data Team focuses on the technical side of AI development, including data collection and curation, AI model training, and benchmark design. Their work ensures that the AI systems are culturally relevant to Morocco.
54
+
55
+ Communication Team
56
+
57
+ Working together to build ATLASIA
58
+
59
+ The Comm Team manages AtlasIA's public image, designing the visual identity, managing social media, and handling public relations. They effectively communicate AtlasIA's goals and achievements to the community and interested parties.
60
+
61
+ ### Join Our Community
62
+
63
+ Be part of the movement to create AI solutions that understand and respect Moroccan culture and values. Contribute your expertise or support our open-source initiatives.
64
+
65
+ [Contribute](https://huggingface.co/atlasia) [Learn More](https://www.atlasia.ma/https://discord.com/invite/Y4szwqJ6jB)
66
+
67
+ ## Our Journey
68
+
69
+ Our strategic timeline to build and deploy Darija language models
70
+
71
+ 1
72
+
73
+ Data Collection
74
+
75
+ Building the foundation
76
+
77
+ Phase 1
78
+
79
+ - 1Build high-quality darija datasets
80
+ - 2Build darija benchmarks
81
+
82
+ Data Collection
83
+
84
+ Building the foundation
85
+
86
+ Phase 1
87
+
88
+ - 1Build high-quality darija datasets
89
+ - 2Build darija benchmarks
90
+
91
+ 2
92
+
93
+ Train Models
94
+
95
+ Bringing intelligence to life
96
+
97
+ Phase 2
98
+
99
+ - 1Machine translation models
100
+ - 2Other surprises
101
+
102
+ Train Models
103
+
104
+ Bringing intelligence to life
105
+
106
+ Phase 2
107
+
108
+ - 1Machine translation models
109
+ - 2Other surprises
110
+
111
+ 3
112
+
113
+ Deploy and Improve
114
+
115
+ Launching to the world
116
+
117
+ Phase 3
118
+
119
+ - 1Model Deployment
120
+ - 2Continuous Improvement
121
+
122
+ Deploy and Improve
123
+
124
+ Launching to the world
125
+
126
+ Phase 3
127
+
128
+ - 1Model Deployment
129
+ - 2Continuous Improvement
130
+
131
+ ![AtlasIA Logo](https://www.atlasia.ma/atlasia_bw_notext_nobg.png)
132
+
133
+ ## Frequently Asked Questions
134
+
135
+ Need more information? [Contact us](mailto:[email protected])
136
+
137
+ Common Questions
138
+
139
+ Find answers to frequently asked questions about ATLASIA
140
+
141
+ ### What is ATLASIA?
142
+ ATLASIA is an open-source initiative dedicated to developing AI models that reflect Moroccan values, identity, and culture. We provide a platform for data collection and storage, making it accessible to the public to promote AI advancements in Morocco.
143
+
144
+ ### How can I access ATLASIA's AI models?
145
+ You can explore our AI models on Hugging Face at https://huggingface.co/atlasia
146
+
147
+ ### Who can contribute to ATLASIA?
148
+ We welcome contributions from anyone interested in advancing AI in Morocco, including developers, researchers, students, and AI enthusiasts. Our project is open to both Moroccan and international contributors.
149
+
150
+ ### How does ATLASIA ensure the data collected represents Moroccan culture?
151
+ We have a rigorous data collection process that focuses on gathering information relevant to Moroccan values, identity, and culture. Our team carefully curates and verifies the data to ensure its authenticity and relevance.
152
+
153
+ ### Is the data collected by ATLASIA publicly available?
154
+ Yes, one of our core principles is to make the collected data accessible to the public. This approach aims to foster AI advancements in Morocco by providing valuable resources to researchers and developers.
155
+
156
+ ### How can I contribute data to ATLASIA?
157
+ We have a user-friendly platform that allows individuals to contribute data. Just choose a task in the home page and follow the guidelines.
158
+
159
+ ### What types of AI models does ATLASIA develop?
160
+ Our focus is on creating models that are specifically tailored to Moroccan contexts. This may include NLP, Computer Vision or Speech-to-text models.
161
+
162
+
163
+ ### How does ATLASIA's work benefit Morocco?
164
+ By developing AI models that understand and reflect Moroccan culture, we're helping to ensure that AI technologies are more relevant and useful for Moroccan users. We're also building local AI expertise and contributing to Morocco's technological advancement.
165
+
166
+ ### Can ATLASIA's models be used for commercial purposes?
167
+ We recommend checking the specific license for each model, as terms may vary.
168
+
169
+ ### How can I stay updated on ATLASIA's latest developments?
170
+ You can follow us on our social media channels for regular updates on our new models, milestones or you can join our discord channel and be part of our amazing community!
171
+
172
+ ### I'm new to AI. How can I learn more and get involved with ATLASIA?
173
+ We welcome contributors of all levels to join our cause! Our discord community is a fostering ground for learning, improving, and having fun! Our members regularly provide resources for AI beginners, including workshops where we can interact and learn together!
174
+
175
+ ### How can I support ATLASIA?
176
+ ATLASIA is an open-source initiative currently without sponsors. If you would like to support our work financially or with ressources, please reach out to any of our co-founders or members, or send an email to [email protected].
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ smolagents
2
+ tqdm
3
+ python-dotenv
retrieve.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import tool
2
+
3
+ @tool
4
+ def about_atlasia() -> str:
5
+ """
6
+ Atlasia Information Retrieval.
7
+ """
8
+ with open("atlasia.txt","r") as file:
9
+ content = file.read()
10
+ file.close()
11
+ return content
tools.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from smolagents import Tool
3
+ from huggingface_hub import list_datasets,list_models,list_organization_members,list_collections,list_spaces
4
+
5
+ class AtlasiaHubInfoTool(Tool):
6
+ name = "atlasia_huggingface_hub_search"
7
+ description = "Search and retrieve information about datasets, models, and spaces of atlasia organization from the HuggingFace Hub"
8
+ inputs = {
9
+ "resource_type": {
10
+ "type": "string",
11
+ "description": "Type of resource to search for. Must be one of: 'dataset', 'model', 'space', 'collection', or 'organization_members'",
12
+ "enum": ["dataset", "model", "space", "collection", "organization_members"]
13
+ }
14
+ }
15
+
16
+ output_type="array"
17
+
18
+ def forward(self,resource_type:str)-> list:
19
+ if not isinstance(resource_type,str):
20
+ raise ValueError("resource_type should be a string")
21
+ if resource_type=="dataset":
22
+ return list(list_datasets(author="atlasia"))
23
+ elif resource_type=="model":
24
+ return list(list_models(author="atlasia"))
25
+ elif resource_type=="space":
26
+ return list(list_spaces(author="atlasia"))
27
+ elif resource_type=="collection":
28
+ return list(list_collections(owner="atlasia"))
29
+ elif resource_type=="organization_members":
30
+ return [x.fullname for x in list(list_organization_members(organization="atlasia"))]
31
+ else:
32
+ raise ValueError("resource_type should be one of: 'dataset', 'model', 'space', 'collection', or 'organization_members'")
33
+
34
+
35
+