akhaliq HF Staff commited on
Commit
f1ddb3a
·
1 Parent(s): bdf5606

update system prompt

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -2095,22 +2095,34 @@ def generate_requirements_txt_with_llm(import_statements):
2095
 
2096
  imports_text = '\n'.join(import_statements)
2097
 
2098
- prompt = f"""Based on the following Python import statements, generate a requirements.txt file with the necessary PyPI packages:
2099
 
2100
  {imports_text}
2101
 
2102
  Instructions:
2103
- - Only include external packages that need to be installed via pip
 
 
 
 
 
 
 
 
 
 
 
 
 
2104
  - Do not include Python built-in modules
2105
- - Use the correct PyPI package names (e.g., cv2 -> opencv-python, PIL -> Pillow, sklearn -> scikit-learn)
2106
- - Do not specify versions unless absolutely necessary for compatibility
2107
  - One package per line
2108
  - If no external packages are needed, return "# No additional dependencies required"
2109
 
2110
- Requirements.txt:"""
2111
 
2112
  messages = [
2113
- {"role": "system", "content": "You are a Python packaging expert. Generate accurate requirements.txt files based on import statements."},
2114
  {"role": "user", "content": prompt}
2115
  ]
2116
 
 
2095
 
2096
  imports_text = '\n'.join(import_statements)
2097
 
2098
+ prompt = f"""Based on the following Python import statements, generate a comprehensive requirements.txt file with all necessary and commonly used related packages:
2099
 
2100
  {imports_text}
2101
 
2102
  Instructions:
2103
+ - Include the direct packages needed for the imports
2104
+ - Include commonly used companion packages and dependencies for better functionality
2105
+ - Use correct PyPI package names (e.g., cv2 -> opencv-python, PIL -> Pillow, sklearn -> scikit-learn)
2106
+ - Examples of comprehensive dependencies:
2107
+ * transformers often needs: accelerate, torch, tokenizers, datasets
2108
+ * gradio often needs: requests, Pillow for image handling
2109
+ * pandas often needs: numpy, openpyxl for Excel files
2110
+ * matplotlib often needs: numpy, pillow for image saving
2111
+ * sklearn often needs: numpy, scipy, joblib
2112
+ * streamlit often needs: pandas, numpy, requests
2113
+ * opencv-python often needs: numpy, pillow
2114
+ * fastapi often needs: uvicorn, pydantic
2115
+ * torch often needs: torchvision, torchaudio (if doing computer vision/audio)
2116
+ - Include packages for common file formats if relevant (openpyxl, python-docx, PyPDF2)
2117
  - Do not include Python built-in modules
2118
+ - Do not specify versions unless there are known compatibility issues
 
2119
  - One package per line
2120
  - If no external packages are needed, return "# No additional dependencies required"
2121
 
2122
+ Generate a comprehensive requirements.txt that ensures the application will work smoothly:"""
2123
 
2124
  messages = [
2125
+ {"role": "system", "content": "You are a Python packaging expert specializing in creating comprehensive, production-ready requirements.txt files. Your goal is to ensure applications work smoothly by including not just direct dependencies but also commonly needed companion packages, popular extensions, and supporting libraries that developers typically need together."},
2126
  {"role": "user", "content": prompt}
2127
  ]
2128