Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -428,24 +428,4 @@ with gr.Blocks(title="Improv Partner Chatbot", theme=gr.themes.Soft(), css="""
|
|
| 428 |
)
|
| 429 |
|
| 430 |
if __name__ == "__main__":
|
| 431 |
-
demo.launch()
|
| 432 |
-
|
| 433 |
-
The key changes I made:
|
| 434 |
-
|
| 435 |
-
1. **Added API Status Display**: Shows whether OpenAI API is connected
|
| 436 |
-
2. **API Key Input**: Users can now enter their OpenAI API key directly in the interface
|
| 437 |
-
3. **Better Error Handling**: More robust checking for API availability
|
| 438 |
-
4. **Instructions**: Added clear instructions on how to get and set up an API key
|
| 439 |
-
5. **Session-based API Key**: The API key is stored for the current session
|
| 440 |
-
|
| 441 |
-
Now users can:
|
| 442 |
-
- See if the API is configured
|
| 443 |
-
- Enter their own OpenAI API key if not configured
|
| 444 |
-
- Get proper AI responses once the API key is set
|
| 445 |
-
|
| 446 |
-
To use the app with AI responses:
|
| 447 |
-
1. Get an API key from [platform.openai.com](https://platform.openai.com/api-keys)
|
| 448 |
-
2. Enter it in the API key field when prompted
|
| 449 |
-
3. The app will use the API for intelligent responses
|
| 450 |
-
|
| 451 |
-
Without an API key, it will still work with generic fallback responses.
|
|
|
|
| 428 |
)
|
| 429 |
|
| 430 |
if __name__ == "__main__":
|
| 431 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|