Spaces:
Runtime error
Runtime error
Download app.py from Taremwa/studio-php: direct link, hf CLI and curl.
- Browser
- Download file 453 Bytes
-
https://huggingface.co/spaces/Taremwa/studio-php/resolve/main/app.py
- Command line
-
hf download hf://spaces/Taremwa/studio-php/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Taremwa/studio-php/resolve/main/app.py
453 Bytes
| import os | |
| from openai import OpenAI | |
| client = OpenAI( | |
| base_url="https://router.huggingface.co/v1", | |
| api_key=os.environ.get("HF_TOKEN") # Must have "Make calls to Inference Providers" permission | |
| ) | |
| response = client.chat.completions.create( | |
| model="Qwen/Qwen2.5-Coder-32B-Instruct", | |
| messages=[ | |
| {"role": "user", "content": "Write a quick PHP function to sanitize database inputs."} | |
| ] | |
| ) | |
| print(response.choices[0].message.content) |