Download app.py from Datacube/README: direct link, hf CLI and curl.
- Browser
- Download file 511 Bytes
-
https://huggingface.co/spaces/Datacube/README/resolve/main/app.py
- Command line
-
hf download hf://spaces/Datacube/README/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Datacube/README/resolve/main/app.py
511 Bytes
| #import gradio as gr | |
| #def greet(name): | |
| # return "Hello " + name + "!!" | |
| #demo = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| #demo.launch() | |
| import requests | |
| import os | |
| API_TOKEN = os.getenv("API_KEY") | |
| API_URL = "https://api-inference.huggingface.co/models/gpt2" | |
| headers = {"Authorization": f"Bearer {API_TOKEN}"} | |
| def query(payload): | |
| response = requests.post(API_URL, headers=headers, json=payload) | |
| return response.json() | |
| data = query("Can you please let us know more details about your ") | |