|
from fastapi import FastAPI, HTTPException |
|
import requests |
|
|
|
app = FastAPI() |
|
|
|
@app.get("/") |
|
def greet_json(): |
|
url = "https://seoroast.co/api/generate-youtube-titles" |
|
headers = { |
|
"Content-Type": "application/json", |
|
"origin": "https://seoroast.co", |
|
"accept": "*/*" |
|
} |
|
payload = { |
|
"content": "A Car Experiment", |
|
"model": "google/gemini-flash-1.5", |
|
"tone": "auto" |
|
} |
|
|
|
try: |
|
response = requests.post(url, headers=headers, json=payload) |
|
response.raise_for_status() |
|
return response.json() |
|
except requests.exceptions.RequestException as e: |
|
raise HTTPException(status_code=500, detail=str(e)) |