Spaces:
Running
Running
Download app/Http/Requests/ChemicalSearchRequest.php from Ailixir-AI-Team/ailixir-api: direct link, hf CLI and curl.
- Browser
- Download file 654 Bytes
-
https://huggingface.co/spaces/Ailixir-AI-Team/ailixir-api/resolve/ff99aeb50b353a35a7604091bfc7cfb19505bf44/app/Http/Requests/ChemicalSearchRequest.php
- Command line
-
hf download hf://spaces/Ailixir-AI-Team/ailixir-api@ff99aeb50b353a35a7604091bfc7cfb19505bf44/app/Http/Requests/ChemicalSearchRequest.php
-
curl -L -o ChemicalSearchRequest.php https://huggingface.co/spaces/Ailixir-AI-Team/ailixir-api/resolve/ff99aeb50b353a35a7604091bfc7cfb19505bf44/app/Http/Requests/ChemicalSearchRequest.php
654 Bytes
| namespace App\Http\Requests; | |
| use Illuminate\Foundation\Http\FormRequest; | |
| class ChemicalSearchRequest extends FormRequest | |
| { | |
| public function authorize(): bool | |
| { | |
| return true; | |
| } | |
| public function rules(): array | |
| { | |
| return [ | |
| 'smiles' => 'required|string', | |
| 'top_k' => 'nullable|integer|min:1|max:50', | |
| ]; | |
| } | |
| public function validated($key = null, $default = null) | |
| { | |
| $validated = parent::validated(); | |
| if (!isset($validated['top_k'])) { | |
| $validated['top_k'] = 3; | |
| } | |
| return $key ? ($validated[$key] ?? $default) : $validated; | |
| } | |
| } | |