fischgpt-api / README.md
kristianfischerai12345's picture
Upload 2 files
2ad73f4 verified

A newer version of the Gradio SDK is available: 5.43.1

Upgrade
metadata
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

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

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

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

{
    "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

Free API hosting powered by HuggingFace Spaces πŸ€—