Spaces:
Runtime error
Runtime error
Download app/main.py from FriendlyUser/startup_apis: direct link, hf CLI and curl.
- Browser
- Download file 706 Bytes
-
https://huggingface.co/spaces/FriendlyUser/startup_apis/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/FriendlyUser/startup_apis/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/FriendlyUser/startup_apis/resolve/main/app/main.py
706 Bytes
| from fastapi import FastAPI | |
| import os | |
| from fastapi.responses import StreamingResponse, FileResponse | |
| from io import BytesIO | |
| from claude_api import Client | |
| from fastapi.middleware.cors import CORSMiddleware | |
| app = FastAPI() | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| async def get_prompt(prompt: str = "Hello World"): | |
| """ | |
| """ | |
| cookie = os.environ.get('CLAUDE_TOKEN', None) | |
| claude_api = Client(cookie) | |
| new_chat = claude_api.create_new_chat() | |
| conversation_id = new_chat['uuid'] | |
| response = claude_api.send_message(prompt, conversation_id) | |
| return all_files | |