Download app.py from LCA/PART_API: direct link, hf CLI and curl.
- Browser
- Download file 996 Bytes
-
https://huggingface.co/spaces/LCA/PART_API/resolve/main/app.py
- Command line
-
hf download hf://spaces/LCA/PART_API/app.py
-
curl -L -o app.py https://huggingface.co/spaces/LCA/PART_API/resolve/main/app.py
996 Bytes
| import gradio as gr | |
| import json | |
| def analyse_prompt(prompt): | |
| # Ici tu peux remplacer par tes propres appels RAG/LLM pour chaque extraction | |
| # --- Extraction simulée pour l'exemple --- | |
| articles = [ | |
| {"code": "A1001", "description": "Tôle acier S235 1mm", "quantite": 10, "source": "stock principal"}, | |
| {"code": "B2002", "description": "Ecrou M8 A4", "quantite": 50, "source": "fournisseur X"} | |
| ] | |
| destinataire = { | |
| "societe": "Société Exemple", | |
| "nom": "Dupont", | |
| "prenom": "Jean", | |
| "email": "jean.dupont@exemple.com" | |
| } | |
| delai = "2024-07-15" | |
| # --- Fin extraction simulée --- | |
| data = { | |
| "articles": articles, | |
| "destinataire": destinataire, | |
| "delai": delai | |
| } | |
| return json.dumps(data, indent=2, ensure_ascii=False) | |
| def greet(name): | |
| return "Hello " + name + "!!" | |
| demo = gr.Interface(fn=analyse_prompt, inputs="text", outputs="text") | |
| if __name__ == "__main__": | |
| demo.launch(share=True) | |