Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,11 @@ import openai
|
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
|
|
|
|
|
|
|
| 5 |
#OpenAi call
|
| 6 |
def regex(texts):
|
| 7 |
-
openai.api_key =
|
| 8 |
response = openai.Completion.create(
|
| 9 |
engine="code-davinci-002",
|
| 10 |
prompt= texts,
|
|
@@ -23,7 +25,7 @@ def regex(texts):
|
|
| 23 |
def greet(prompt):
|
| 24 |
txt= (f'''Perfect Regex Generator \n #Prompt: {prompt}\n#Regex:\n''')
|
| 25 |
regex = gpt3(txt)
|
| 26 |
-
return
|
| 27 |
|
| 28 |
|
| 29 |
#Code to set up Gradio UI
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
|
| 5 |
+
secret = os.environ["Secret"]
|
| 6 |
+
print(secret)
|
| 7 |
#OpenAi call
|
| 8 |
def regex(texts):
|
| 9 |
+
openai.api_key = secret
|
| 10 |
response = openai.Completion.create(
|
| 11 |
engine="code-davinci-002",
|
| 12 |
prompt= texts,
|
|
|
|
| 25 |
def greet(prompt):
|
| 26 |
txt= (f'''Perfect Regex Generator \n #Prompt: {prompt}\n#Regex:\n''')
|
| 27 |
regex = gpt3(txt)
|
| 28 |
+
return regex
|
| 29 |
|
| 30 |
|
| 31 |
#Code to set up Gradio UI
|