YouriLalain commited on
Commit
b168997
1 Parent(s): 0456f25
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -29,6 +29,11 @@ def extract_text_from_pdf(pdf_file):
29
  text += page.get_text()
30
  return text
31
 
 
 
 
 
 
32
  def chatbot_response(message, history, pdf_text=None, image_path=None):
33
  messages = [{"role": "system", "content": "Vous êtes un assistant IA utile et amical, capable d'analyser des images et du texte."}]
34
 
@@ -140,7 +145,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
140
  # Efface la conversation
141
  clear.click(clear_chat, None, [chatbot, pdf_text, image_upload], queue=False)
142
 
143
- demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 5000)), share=True)
144
 
145
  # Lancer l'application Flask pour la gestion des API
146
 
 
29
  text += page.get_text()
30
  return text
31
 
32
+ def encode_image(image_path):
33
+ with open(image_path, "rb") as image_file:
34
+ encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
35
+ return encoded_string
36
+
37
  def chatbot_response(message, history, pdf_text=None, image_path=None):
38
  messages = [{"role": "system", "content": "Vous êtes un assistant IA utile et amical, capable d'analyser des images et du texte."}]
39
 
 
145
  # Efface la conversation
146
  clear.click(clear_chat, None, [chatbot, pdf_text, image_upload], queue=False)
147
 
148
+ demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 5000)))
149
 
150
  # Lancer l'application Flask pour la gestion des API
151