Spaces:
Runtime error
Runtime error
Download mcp_tools/code_suggester.py from abhidgp1978/flowforge-ai: direct link, hf CLI and curl.
- Browser
- Download file 634 Bytes
-
https://huggingface.co/spaces/abhidgp1978/flowforge-ai/resolve/main/mcp_tools/code_suggester.py
- Command line
-
hf download hf://spaces/abhidgp1978/flowforge-ai/mcp_tools/code_suggester.py
-
curl -L -o code_suggester.py https://huggingface.co/spaces/abhidgp1978/flowforge-ai/resolve/main/mcp_tools/code_suggester.py
634 Bytes
| from mcp_tools import register_tool | |
| from transformers import pipeline | |
| def code_suggester(workflow: str): | |
| gen = pipeline("text-generation", model="Salesforce/codegen-350M-mono") | |
| prompt = ( | |
| "Write clean, well-commented starter Python code for this project:\n\n" | |
| f"{workflow}\n\n" | |
| "Code should define classes, functions, and placeholders logically." | |
| ) | |
| output = gen( | |
| prompt, | |
| max_new_tokens=256, | |
| temperature=0.6, | |
| repetition_penalty=1.9, | |
| top_p=0.9, | |
| do_sample=True, | |
| )[0]["generated_text"] | |
| return output.strip() | |