abhilashnl2006 commited on
Commit
4ea6059
1 Parent(s): c206229

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,5 +1,14 @@
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
- import openai
3
 
4
  # Replace with your actual OpenAI API key
5
  openai.api_key = "your-api-key-here"
 
1
+ import subprocess
2
+ import sys
3
+
4
+ # Check if openai is installed, if not, install it
5
+ try:
6
+ import openai
7
+ except ImportError:
8
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "openai"])
9
+ import openai
10
+
11
  import gradio as gr
 
12
 
13
  # Replace with your actual OpenAI API key
14
  openai.api_key = "your-api-key-here"