--- title: FischGPT API emoji: 🚀 colorFrom: blue colorTo: purple sdk: gradio sdk_version: 4.12.0 app_file: app.py pinned: false license: mit --- # FischGPT API Backend This Space provides a **free API endpoint** for FischGPT-SFT, a GPT-2 style transformer built from scratch. ## 🔌 API Endpoint **URL:** `https://kristianfischerai12345-fischgpt-api.hf.space/api/predict` ## 📋 Usage Examples ### Python ```python import requests response = requests.post( "https://kristianfischerai12345-fischgpt-api.hf.space/api/predict", json={ "data": [ "Explain machine learning", # message 0.8, # temperature 150, # max_length 0.9 # top_p ] } ) result = response.json() print(result["data"][0]["response"]) ``` ### JavaScript/React ```javascript const callFischGPT = async (message) => { const response = await fetch( "https://kristianfischerai12345-fischgpt-api.hf.space/api/predict", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ data: [message, 0.8, 150, 0.9] }) } ); const result = await response.json(); return result.data[0].response; }; ``` ### cURL ```bash curl -X POST "https://kristianfischerai12345-fischgpt-api.hf.space/api/predict" \ -H "Content-Type: application/json" \ -d '{"data": ["Hello, how are you?", 0.8, 150, 0.9]}' ``` ## 📊 Response Format ```json { "data": [{ "error": null, "response": "Generated text response...", "metadata": { "input_tokens": 10, "output_tokens": 35, "new_tokens": 25, "generation_time": 1.234, "tokens_per_second": 20.3, "model": "FischGPT-SFT", "parameters": { "temperature": 0.8, "max_length": 150, "top_p": 0.9 } } }] } ``` ## 🎯 Parameters - **user_message** (string): The input message - **temperature** (float, 0.1-2.0): Sampling temperature (higher = more creative) - **max_length** (int, 50-300): Maximum response length in tokens - **top_p** (float, 0.1-1.0): Top-p sampling (higher = more diverse) ## 🏆 Model Details - **Architecture:** GPT-2 style decoder-only transformer - **Parameters:** ~124M (12 layers × 768 hidden × 12 heads) - **Training:** 10B tokens pretraining + supervised fine-tuning - **Features:** Flash attention, custom weight initialization ## 🔗 Related Links - **Model Repository:** [kristianfischerai12345/fischgpt-sft](https://huggingface.co/kristianfischerai12345/fischgpt-sft) - **Source Code:** [GitHub](https://github.com/yourusername/FischGPT) *Free API hosting powered by HuggingFace Spaces 🤗*