mohamed.tsouli commited on
Commit
8fa2802
·
1 Parent(s): f675048

initial commit

Browse files
.gradio/cached_examples/16/log.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ component 0,timestamp
2
+ "[[""Comment fait on pour produire du ma\u00efs ?"", ""This is a dummy response""]]",2025-02-08 18:06:46.963179
3
+ "[[""R\u00e9dige moi une lettre pour faire un stage dans une exploitation agricole"", ""This is a dummy response""]]",2025-02-08 18:06:46.972047
4
+ "[[""Comment reprendre une exploitation agricole ?"", ""This is a dummy response""]]",2025-02-08 18:06:46.980410
.gradio/certificate.pem ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
3
+ TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
4
+ cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
5
+ WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
6
+ ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
7
+ MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
8
+ h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
9
+ 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
10
+ A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
11
+ T8KOEUt+zwvo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+63SM1N95R1NbdWhscdCb+ZAJzVc
27
+ oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
28
+ 4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
29
+ mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
30
+ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
31
+ -----END CERTIFICATE-----
chatbot-gaia-1/__init__.py ADDED
File without changes
app.py → chatbot-gaia-1/app.py RENAMED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
- from mistralai.client import MistralClient
3
- from mistralai.models.chat_completion import ChatMessage
4
  import os
5
 
6
  title = "Gaia Mistral Chat Demo"
@@ -9,14 +9,20 @@ placeholder = "Posez moi une question sur l'agriculture"
9
  examples = ["Comment fait on pour produire du maïs ?", "Rédige moi une lettre pour faire un stage dans une exploitation agricole", "Comment reprendre une exploitation agricole ?"]
10
  api_key = os.environ.get("MISTRAL_API_KEY")
11
 
12
- client = MistralClient(api_key=api_key)
 
13
  model = 'open-mixtral-8x7b'
14
-
15
  def chat_with_mistral(user_input, history):
16
- messages = [ChatMessage(role="user", content=user_input)]
17
 
18
- chat_response = client.chat(model=model, messages=messages)
19
  return chat_response.choices[0].message.content
 
 
 
 
 
20
 
21
  iface = gr.ChatInterface(
22
  fn=chat_with_mistral,
@@ -27,9 +33,6 @@ iface = gr.ChatInterface(
27
  theme="soft",
28
  examples=examples,
29
  cache_examples=True,
30
- retry_btn=None,
31
- undo_btn="Annuler",
32
- clear_btn="Effacer",
33
  )
34
 
35
  iface.launch(share=True)
 
1
  import gradio as gr
2
+ from mistralai import Mistral, UserMessage
3
+
4
  import os
5
 
6
  title = "Gaia Mistral Chat Demo"
 
9
  examples = ["Comment fait on pour produire du maïs ?", "Rédige moi une lettre pour faire un stage dans une exploitation agricole", "Comment reprendre une exploitation agricole ?"]
10
  api_key = os.environ.get("MISTRAL_API_KEY")
11
 
12
+ #client = MistralClient(api_key=api_key)
13
+ client = Mistral(api_key=api_key)
14
  model = 'open-mixtral-8x7b'
15
+ """
16
  def chat_with_mistral(user_input, history):
17
+ messages = [{"role": "user", "content": user_input}]
18
 
19
+ chat_response = client.chat.complete(model=model, messages=messages)
20
  return chat_response.choices[0].message.content
21
+ """
22
+
23
+ def chat_with_mistral(user_input, history):
24
+ messages = [{"role": "user", "content": user_input}]
25
+ return "This is a dummy response"
26
 
27
  iface = gr.ChatInterface(
28
  fn=chat_with_mistral,
 
33
  theme="soft",
34
  examples=examples,
35
  cache_examples=True,
 
 
 
36
  )
37
 
38
  iface.launch(share=True)
chatbot-gaia-1/src/__init__.py ADDED
File without changes
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "chatbot-gaia-1"
3
+ version = "0.1.0"
4
+ description = "chatebot level 1 GAIA generative AI for Agriculture"
5
+ authors = ["mohamed.tsouli"]
6
+ readme = "README.md"
7
+ packages = [{include = "chatbot-gaia-1"}]
8
+
9
+
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.11"
13
+ mistralai = "^1.5.0"
14
+ gradio = "^5.15.0"
15
+
16
+
17
+ [build-system]
18
+ requires = ["poetry-core"]
19
+ build-backend = "poetry.core.masonry.api"