ionosphere commited on
Commit
b04ff52
·
1 Parent(s): faaf179
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -20,12 +20,11 @@ from llama_index.vector_stores.chroma import ChromaVectorStore
20
 
21
  load_dotenv()
22
 
23
- title = "Gaia Mistral 8x7b Chat RAG PDF Demo"
24
  description = "Example of an assistant with Gradio, RAG from PDF documents and Mistral AI via its API"
25
  placeholder = (
26
  "Vous pouvez me posez une question sur ce contexte, appuyer sur Entrée pour valider"
27
  )
28
- placeholder_url = "Extract text from this url"
29
  llm_model = "open-mixtral-8x22b"
30
 
31
  env_api_key = os.environ.get("MISTRAL_API_KEY")
@@ -96,24 +95,24 @@ def load_document(input_file):
96
 
97
  with gr.Blocks() as demo:
98
  gr.Markdown(
99
- """ # Welcome to Gaia Level 3 Demo
100
 
101
- Add a file before interacting with the Chat.
102
- This demo allows you to interact with a pdf file and then ask questions to Mistral APIs.
103
- Mistral will answer with the context extracted from your uploaded file.
104
 
105
  *The files will stay in the database unless there is 48h of inactivty or you re-build the space.*
106
  """
107
  )
108
 
109
- gr.Markdown(""" ### 1 / Extract data from PDF """)
110
 
111
  with gr.Row():
112
  with gr.Column():
113
  input_file = gr.File(
114
- label="Load a pdf",
115
  file_types=[".pdf"],
116
- file_count="single",
117
  type="filepath",
118
  interactive=True,
119
  )
@@ -131,15 +130,15 @@ with gr.Blocks() as demo:
131
  )
132
 
133
  help_msg = gr.Markdown(
134
- value="Once the document is loaded, press the Encode button below to add it to the db."
135
  )
136
 
137
- file_btn = gr.Button(value="Encode file ✅", interactive=True)
138
  btn_msg = gr.Textbox(container=False, visible=False)
139
 
140
  with gr.Row():
141
  db_list = gr.Markdown(value=get_documents_in_db)
142
- delete_btn = gr.Button(value="Empty db 🗑️", interactive=True, scale=0)
143
 
144
  file_btn.click(
145
  load_file,
@@ -149,7 +148,7 @@ with gr.Blocks() as demo:
149
  )
150
  delete_btn.click(empty_db, outputs=[db_list], show_progress="minimal")
151
 
152
- gr.Markdown(""" ### 2 / Ask a question about this context """)
153
 
154
  chatbot = gr.Chatbot()
155
  msg = gr.Textbox(placeholder=placeholder)
 
20
 
21
  load_dotenv()
22
 
23
+ title = "AgreenDefi Gaia 8x22b PDF Demo"
24
  description = "Example of an assistant with Gradio, RAG from PDF documents and Mistral AI via its API"
25
  placeholder = (
26
  "Vous pouvez me posez une question sur ce contexte, appuyer sur Entrée pour valider"
27
  )
 
28
  llm_model = "open-mixtral-8x22b"
29
 
30
  env_api_key = os.environ.get("MISTRAL_API_KEY")
 
95
 
96
  with gr.Blocks() as demo:
97
  gr.Markdown(
98
+ """ # Bienvenue sur la démo AgreenDefi PDF
99
 
100
+ Ajouter un fichier avant de poser une question sur le tchat.
101
+ Cette démo vous permet d'interagir entre des fichiers PDF et Mistral AI via son API.
102
+ Mistral va répondre à vos questions par rapport au document.
103
 
104
  *The files will stay in the database unless there is 48h of inactivty or you re-build the space.*
105
  """
106
  )
107
 
108
+ gr.Markdown(""" ### 1 / Préparer les données """)
109
 
110
  with gr.Row():
111
  with gr.Column():
112
  input_file = gr.File(
113
+ label="Charger des fichiers pdf",
114
  file_types=[".pdf"],
115
+ file_count="multiple",
116
  type="filepath",
117
  interactive=True,
118
  )
 
130
  )
131
 
132
  help_msg = gr.Markdown(
133
+ value="Quan le document est chargé, Appuyer sur Encode pour l'ajouter dans la base de données."
134
  )
135
 
136
+ file_btn = gr.Button(value="Encoder les fichiers ✅", interactive=True)
137
  btn_msg = gr.Textbox(container=False, visible=False)
138
 
139
  with gr.Row():
140
  db_list = gr.Markdown(value=get_documents_in_db)
141
+ delete_btn = gr.Button(value="Vider la base 🗑️", interactive=True, scale=0)
142
 
143
  file_btn.click(
144
  load_file,
 
148
  )
149
  delete_btn.click(empty_db, outputs=[db_list], show_progress="minimal")
150
 
151
+ gr.Markdown(""" ### 2 / Poser une question selon le contexte """)
152
 
153
  chatbot = gr.Chatbot()
154
  msg = gr.Textbox(placeholder=placeholder)