Salahin commited on
Commit
ef83df2
·
2 Parent(s): a7ebc6192dc9ac

Merge branch 'main' of https://huggingface.co/spaces/salahin/random-api into hf-branch

Browse files
Files changed (2) hide show
  1. .gitattributes +35 -0
  2. README.md +9 -155
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,155 +1,9 @@
1
- Random API
2
- ===========
3
- A FastAPI application that provides a variety of randomization endpoints for generating random data, simulating random events, and more.
4
-
5
- Features
6
- ----------
7
-
8
- * Generate random floats, integers and characters
9
- * Simulate coin tosses and random choices
10
- * Generate random users and passwords
11
-
12
- Endpoints
13
- -----------
14
-
15
- ### `/`
16
-
17
- * **Method:** GET
18
- * **Description:** Server status
19
- * **Response:** {"message": "Server is running"}
20
-
21
-
22
- ### `/random`
23
-
24
- * **Method:** GET
25
- * **Description:** Returns a random float between 0 and 1.
26
- * **Response:** `{"float": <random_float>}`
27
- * **Errors:**
28
- + `500 Internal Server Error`: If an error occurs while generating the random float.
29
-
30
- ### `/random/int`
31
-
32
- * **Method:** GET
33
- * **Description:** Returns a random integer.
34
- * **Response:** `{"int": <random_int>}`
35
- * **Errors:**
36
- + `500 Internal Server Error`: If an error occurs while generating the random integers.
37
-
38
-
39
-
40
-
41
- ### `/random/int/{left}/{right}`
42
-
43
- * **Method:** GET
44
- * **Description:** Returns a random integer within the specified range.
45
- * **Parameters:**
46
- + `left`: The minimum value of the range (inclusive).
47
- + `right`: The maximum value of the range (inclusive).
48
- * **Response:** `{"int": <random_int>}`
49
- * **Errors:**
50
- + `400 Bad Request`: If `left` is greater than `right`.
51
- + `500 Internal Server Error`: If an error occurs while generating the random integer.
52
-
53
-
54
- ### `/random/char`
55
-
56
- * **Method:** GET
57
- * **Description:** Returns a random ASCII character.
58
- * **Response:** `{"char": <random_char>}`
59
- * **Errors:**
60
- + `500 Internal Server Error`: If an error occurs while generating the random character.
61
-
62
-
63
- ### `/random/coinflip`
64
-
65
- * **Method:** GET
66
- * **Description:** Simulates a coin toss and returns the result.
67
- * **Response:** `{"result": "Heads" or "Tails"}`
68
- * **Errors:**
69
- + `500 Internal Server Error`: If an error occurs while simulating the coin toss.
70
-
71
-
72
- ### `/random/select/{options}`
73
-
74
- * **Method:** GET
75
- * **Description:** Selects a random option from the given list.
76
- * **Parameters:**
77
- + `options`: A JSON-encoded list of options.
78
- * **Response:** `{"selected": <random_option>}`
79
- * **Errors:**
80
- + `400 Bad Request`: If `options` is an empty list or not a valid JSON-encoded list.
81
- + `500 Internal Server Error`: If an error occurs while selecting the random option.
82
-
83
-
84
- ### `/random/color`
85
-
86
- * **Method:** GET
87
- * **Description:** Returns a random hex color.
88
- * **Response:** `{"color": <random_color>}`
89
- * **Errors:**
90
- + `500 Internal Server Error`: If an error occurs while generating the random color.
91
-
92
-
93
- ### `/random/user`
94
-
95
- * **Method:** GET
96
- * **Description:** Generates a random user with name, email, and password.
97
- * **Response:** `{"name": <random_name>, "email": <random_email>, "password": <random_password>}`
98
- * **Errors:**
99
- + `500 Internal Server Error`: If an error occurs while generating the random user data.
100
-
101
-
102
- ### `/random/password/{length}`
103
-
104
- * **Method:** GET
105
- * **Description:** Generates a random password of the specified length.
106
- * **Parameters:**
107
- + `length`: The length of the password.
108
- * **Response:** `{"password": <random_password>}`
109
- * **Errors:**
110
- + `400 Bad Request`: If `length` is less than 1.
111
- + `500 Internal Server Error`: If an error occurs while generating the random password.
112
-
113
-
114
-
115
- Live API
116
- --------
117
-
118
- The API is live at:
119
- * *https://salahin-random-api.hf.space/*
120
- * *https://random-api-dnl4.onrender.com/*
121
-
122
- You can test the endpoints using your favorite HTTP client or tool, such as `curl` or `Postman`.
123
-
124
- Installation (for Development)
125
- ------------
126
-
127
- To install the required dependencies for development, run:
128
- ```
129
- pip install -r requirements.txt
130
- ```
131
-
132
- Running the API (for Development)
133
- ---------------
134
-
135
- To run the API locally for development, execute:
136
- ```
137
- uvicorn main:app --reload
138
- ```
139
-
140
- This will start the API server on `http://localhost:8000`.
141
-
142
- License
143
- -------
144
-
145
- This API is licensed under the MIT License.
146
-
147
- Contributing
148
- ------------
149
-
150
- Contributions are welcome! If you'd like to add a new endpoint or feature, please submit a pull request.
151
-
152
- Acknowledgments
153
- -----------------
154
-
155
- Thanks to the FastAPI and Python communities for making this project possible.
 
1
+ ---
2
+ title: Random Api
3
+ emoji: 🏆
4
+ colorFrom: purple
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference