Spaces:
Paused
Paused
| from fastapi import FastAPI | |
| import openai | |
| app = FastAPI() | |
| # Set up OpenAI API key | |
| openai.api_key = "" | |
| def generate_text(prompt: str): | |
| response = openai.Completion.create( | |
| engine="gpt-4", # Replace with the GPT-4 engine when available | |
| prompt=prompt, | |
| max_tokens=1024, | |
| temperature=0.7, | |
| ) | |
| return response.choices[0].text | |
| # Run the app with `uvicorn main:app --reload` |