RayanMLK commited on
Commit
dbdcc4e
Β·
1 Parent(s): eab266a

Fix: remove gradio from requirements, use ChatInterface for 4.42 compat

Browse files
Files changed (2) hide show
  1. app.py +5 -4
  2. requirements.txt +8 -11
app.py CHANGED
@@ -1,7 +1,8 @@
1
  """
2
  app.py β€” ECE Intelligence Lab Chatbot β€” Gradio Interface (HF Spaces)
3
  ───────────────────────────────────────────────────────────────────────────────
4
- Uses gr.ChatInterface (Gradio 3.x stable) β€” no type= argument needed.
 
5
  """
6
 
7
  import os
@@ -39,7 +40,7 @@ print("Pipeline ready!")
39
  def respond(user_message: str, history: list) -> str:
40
  """
41
  gr.ChatInterface signature: (message, history) -> str
42
- history is managed automatically by Gradio.
43
  """
44
  if not user_message.strip():
45
  return "Veuillez entrer une question."
@@ -61,9 +62,9 @@ demo = gr.ChatInterface(
61
  description="""
62
  **Premier *Fab IA* de France** Β· Hugging Face Β· LangChain Β· FAISS
63
 
64
- Posez vos questions sur l'Intelligence Lab : vision, modèles IA, infrastructure, partenaires, pédagogie, éthique...
65
 
66
- *Les rΓ©ponses sont gΓ©nΓ©rΓ©es uniquement Γ  partir de la base de connaissances de l'Intelligence Lab ECE.*
67
  """,
68
  examples=[
69
  "Qu'est-ce que l'Intelligence Lab de l'ECE ?",
 
1
  """
2
  app.py β€” ECE Intelligence Lab Chatbot β€” Gradio Interface (HF Spaces)
3
  ───────────────────────────────────────────────────────────────────────────────
4
+ Compatible with gradio 4.42.0 forced by HF Spaces.
5
+ Uses gr.ChatInterface to avoid gr.Chatbot type= and gradio_client bugs.
6
  """
7
 
8
  import os
 
40
  def respond(user_message: str, history: list) -> str:
41
  """
42
  gr.ChatInterface signature: (message, history) -> str
43
+ Gradio manages history automatically β€” no manual tuple/dict handling.
44
  """
45
  if not user_message.strip():
46
  return "Veuillez entrer une question."
 
62
  description="""
63
  **Premier *Fab IA* de France** Β· Hugging Face Β· LangChain Β· FAISS
64
 
65
+ Posez vos questions sur la vision, les modèles IA, l'infrastructure, les partenaires, la pédagogie et l'éthique de l'Intelligence Lab.
66
 
67
+ *Les rΓ©ponses sont gΓ©nΓ©rΓ©es uniquement Γ  partir de la base de connaissances ECE.*
68
  """,
69
  examples=[
70
  "Qu'est-ce que l'Intelligence Lab de l'ECE ?",
requirements.txt CHANGED
@@ -1,14 +1,14 @@
1
  # ─── Core LLM & RAG ───────────────────────────────────────────────────────────
2
- langchain>=0.2.16
3
- langchain-core>=0.2.0
4
- langchain-community>=0.2.16
5
- langchain-huggingface>=0.0.3
6
- langchain-text-splitters>=0.2.0
7
 
8
  # ─── Hugging Face ─────────────────────────────────────────────────────────────
9
- transformers>=4.44.2
10
  huggingface-hub>=0.24.6
11
- sentence-transformers>=3.0.1
12
  torch>=2.6.0
13
 
14
  # ─── Vector Store ─────────────────────────────────────────────────────────────
@@ -18,11 +18,8 @@ faiss-cpu>=1.8.0
18
  pypdf>=4.3.1
19
  python-docx>=1.1.2
20
 
21
- # ─── Interface ────────────────────────────────────────────────────────────────
22
- # Pinned to 3.50.2 : stable, compatible HF Spaces, no gradio_client conflicts
23
- gradio==3.50.2
24
-
25
  # ─── Utilities ────────────────────────────────────────────────────────────────
 
26
  python-dotenv>=1.0.1
27
  pydantic>=2.8.2
28
  tqdm>=4.66.5
 
1
  # ─── Core LLM & RAG ───────────────────────────────────────────────────────────
2
+ langchain>=0.2.16,<1.0.0
3
+ langchain-core>=0.2.0,<1.0.0
4
+ langchain-community>=0.2.16,<1.0.0
5
+ langchain-huggingface>=0.0.3,<1.0.0
6
+ langchain-text-splitters>=0.2.0,<1.0.0
7
 
8
  # ─── Hugging Face ─────────────────────────────────────────────────────────────
9
+ transformers>=4.44.2,<5.0.0
10
  huggingface-hub>=0.24.6
11
+ sentence-transformers>=3.0.1,<4.0.0
12
  torch>=2.6.0
13
 
14
  # ─── Vector Store ─────────────────────────────────────────────────────────────
 
18
  pypdf>=4.3.1
19
  python-docx>=1.1.2
20
 
 
 
 
 
21
  # ─── Utilities ────────────────────────────────────────────────────────────────
22
+ # NOTE: do NOT add gradio here β€” HF Spaces installs gradio==4.42.0 itself.
23
  python-dotenv>=1.0.1
24
  pydantic>=2.8.2
25
  tqdm>=4.66.5