Spaces:
Sleeping
Sleeping
Download app.py from buchi-stdesign/Gemini_API_iPhone: direct link, hf CLI and curl.
- Browser
- Download file 548 Bytes
-
https://huggingface.co/spaces/buchi-stdesign/Gemini_API_iPhone/resolve/main/app.py
- Command line
-
hf download hf://spaces/buchi-stdesign/Gemini_API_iPhone/app.py
-
curl -L -o app.py https://huggingface.co/spaces/buchi-stdesign/Gemini_API_iPhone/resolve/main/app.py
548 Bytes
| from fastapi import FastAPI, Request | |
| import os | |
| import google.generativeai as genai | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") | |
| genai.configure(api_key=GEMINI_API_KEY) | |
| model = genai.GenerativeModel("gemini-1.5-flash") | |
| app = FastAPI() | |
| async def generate_story(request: Request): | |
| data = await request.json() | |
| prompt = data.get("prompt", "3εδ»₯ε γ§η γγγγ¨γθ©±γγγ γγγ") | |
| response = model.generate_content(prompt) | |
| return {"story": response.text} |