Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- README.md +112 -13
- requirements.txt +0 -0
README.md
CHANGED
@@ -1,13 +1,112 @@
|
|
1 |
-
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: mit
|
11 |
-
---
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: FischGPT API
|
3 |
+
emoji: π
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.12.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
---
|
12 |
+
|
13 |
+
# FischGPT API Backend
|
14 |
+
|
15 |
+
This Space provides a **free API endpoint** for FischGPT-SFT, a GPT-2 style transformer built from scratch.
|
16 |
+
|
17 |
+
## π API Endpoint
|
18 |
+
|
19 |
+
**URL:** `https://kristianfischerai12345-fischgpt-api.hf.space/api/predict`
|
20 |
+
|
21 |
+
## π Usage Examples
|
22 |
+
|
23 |
+
### Python
|
24 |
+
```python
|
25 |
+
import requests
|
26 |
+
|
27 |
+
response = requests.post(
|
28 |
+
"https://kristianfischerai12345-fischgpt-api.hf.space/api/predict",
|
29 |
+
json={
|
30 |
+
"data": [
|
31 |
+
"Explain machine learning", # message
|
32 |
+
0.8, # temperature
|
33 |
+
150, # max_length
|
34 |
+
0.9 # top_p
|
35 |
+
]
|
36 |
+
}
|
37 |
+
)
|
38 |
+
|
39 |
+
result = response.json()
|
40 |
+
print(result["data"][0]["response"])
|
41 |
+
```
|
42 |
+
|
43 |
+
### JavaScript/React
|
44 |
+
```javascript
|
45 |
+
const callFischGPT = async (message) => {
|
46 |
+
const response = await fetch(
|
47 |
+
"https://kristianfischerai12345-fischgpt-api.hf.space/api/predict",
|
48 |
+
{
|
49 |
+
method: "POST",
|
50 |
+
headers: { "Content-Type": "application/json" },
|
51 |
+
body: JSON.stringify({
|
52 |
+
data: [message, 0.8, 150, 0.9]
|
53 |
+
})
|
54 |
+
}
|
55 |
+
);
|
56 |
+
|
57 |
+
const result = await response.json();
|
58 |
+
return result.data[0].response;
|
59 |
+
};
|
60 |
+
```
|
61 |
+
|
62 |
+
### cURL
|
63 |
+
```bash
|
64 |
+
curl -X POST "https://kristianfischerai12345-fischgpt-api.hf.space/api/predict" \
|
65 |
+
-H "Content-Type: application/json" \
|
66 |
+
-d '{"data": ["Hello, how are you?", 0.8, 150, 0.9]}'
|
67 |
+
```
|
68 |
+
|
69 |
+
## π Response Format
|
70 |
+
|
71 |
+
```json
|
72 |
+
{
|
73 |
+
"data": [{
|
74 |
+
"error": null,
|
75 |
+
"response": "Generated text response...",
|
76 |
+
"metadata": {
|
77 |
+
"input_tokens": 10,
|
78 |
+
"output_tokens": 35,
|
79 |
+
"new_tokens": 25,
|
80 |
+
"generation_time": 1.234,
|
81 |
+
"tokens_per_second": 20.3,
|
82 |
+
"model": "FischGPT-SFT",
|
83 |
+
"parameters": {
|
84 |
+
"temperature": 0.8,
|
85 |
+
"max_length": 150,
|
86 |
+
"top_p": 0.9
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}]
|
90 |
+
}
|
91 |
+
```
|
92 |
+
|
93 |
+
## π― Parameters
|
94 |
+
|
95 |
+
- **user_message** (string): The input message
|
96 |
+
- **temperature** (float, 0.1-2.0): Sampling temperature (higher = more creative)
|
97 |
+
- **max_length** (int, 50-300): Maximum response length in tokens
|
98 |
+
- **top_p** (float, 0.1-1.0): Top-p sampling (higher = more diverse)
|
99 |
+
|
100 |
+
## π Model Details
|
101 |
+
|
102 |
+
- **Architecture:** GPT-2 style decoder-only transformer
|
103 |
+
- **Parameters:** ~124M (12 layers Γ 768 hidden Γ 12 heads)
|
104 |
+
- **Training:** 10B tokens pretraining + supervised fine-tuning
|
105 |
+
- **Features:** Flash attention, custom weight initialization
|
106 |
+
|
107 |
+
## π Related Links
|
108 |
+
|
109 |
+
- **Model Repository:** [kristianfischerai12345/fischgpt-sft](https://huggingface.co/kristianfischerai12345/fischgpt-sft)
|
110 |
+
- **Source Code:** [GitHub](https://github.com/yourusername/FischGPT)
|
111 |
+
|
112 |
+
*Free API hosting powered by HuggingFace Spaces π€*
|
requirements.txt
ADDED
File without changes
|