Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,13 +19,15 @@ from PIL import Image
|
|
19 |
from stability_sdk import client
|
20 |
import stability_sdk.interfaces.gooseai.generation.generation_pb2 as generation
|
21 |
|
22 |
-
os.environ['STABILITY_HOST'] = 'grpc.stability.ai:443'
|
23 |
-
os.environ['STABILITY_KEY'] = 'sk-Ndzkpi6OYwM5fQgEJAVwRPbFZSMNyFk0GoZw1EvNtqVExGdi'
|
24 |
-
os.environ['GOOGLE_API'] = 'e77d5416608a110ea2babd7b2e33ede48b0c4159ade5cfd5cebbc7483c513ff3'
|
25 |
-
os.environ['OPENAI_KEY'] = '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'
|
|
|
26 |
|
27 |
stability_api = client.StabilityInference(
|
28 |
-
key=os.environ
|
|
|
29 |
verbose=True, # Print debug messages.
|
30 |
engine="stable-diffusion-v1-5", # Set the engine to use for generation.
|
31 |
# Available engines: stable-diffusion-v1 stable-diffusion-v1-5 stable-diffusion-512-v2-0 stable-diffusion-768-v2-0
|
@@ -40,7 +42,7 @@ def search_internet(question):
|
|
40 |
"gl": "in",
|
41 |
"google_domain": "google.co.in",
|
42 |
# "api_key": ""
|
43 |
-
"api_key": os.environ['GOOGLE_API']
|
44 |
}
|
45 |
|
46 |
params = {
|
@@ -50,7 +52,7 @@ def search_internet(question):
|
|
50 |
"gl": "in",
|
51 |
"google_domain": "google.co.in",
|
52 |
# "api_key": ""
|
53 |
-
"api_key": os.environ['GOOGLE_API']
|
54 |
}
|
55 |
|
56 |
search = GoogleSearch(params)
|
@@ -81,7 +83,7 @@ def search_internet(question):
|
|
81 |
st.write(snippets)
|
82 |
|
83 |
# openai.api_key = ""
|
84 |
-
openai.api_key = os.environ['OPENAI_KEY']
|
85 |
|
86 |
def openai_response(PROMPT):
|
87 |
response = openai.Image.create(
|
|
|
19 |
from stability_sdk import client
|
20 |
import stability_sdk.interfaces.gooseai.generation.generation_pb2 as generation
|
21 |
|
22 |
+
# os.environ['STABILITY_HOST'] = 'grpc.stability.ai:443'
|
23 |
+
# os.environ['STABILITY_KEY'] = 'sk-Ndzkpi6OYwM5fQgEJAVwRPbFZSMNyFk0GoZw1EvNtqVExGdi'
|
24 |
+
# os.environ['GOOGLE_API'] = 'e77d5416608a110ea2babd7b2e33ede48b0c4159ade5cfd5cebbc7483c513ff3'
|
25 |
+
# os.environ['OPENAI_KEY'] = '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'
|
26 |
+
|
27 |
|
28 |
stability_api = client.StabilityInference(
|
29 |
+
key=os.environ.getattribute('STABILITY_KEY'),
|
30 |
+
# key=os.environ['STABILITY_KEY'], # API Key reference.
|
31 |
verbose=True, # Print debug messages.
|
32 |
engine="stable-diffusion-v1-5", # Set the engine to use for generation.
|
33 |
# Available engines: stable-diffusion-v1 stable-diffusion-v1-5 stable-diffusion-512-v2-0 stable-diffusion-768-v2-0
|
|
|
42 |
"gl": "in",
|
43 |
"google_domain": "google.co.in",
|
44 |
# "api_key": ""
|
45 |
+
"api_key": os.environ.getattribute('GOOGLE_API') #os.environ['GOOGLE_API']
|
46 |
}
|
47 |
|
48 |
params = {
|
|
|
52 |
"gl": "in",
|
53 |
"google_domain": "google.co.in",
|
54 |
# "api_key": ""
|
55 |
+
"api_key": os.environ.getattribute('GOOGLE_API') #os.environ['GOOGLE_API']
|
56 |
}
|
57 |
|
58 |
search = GoogleSearch(params)
|
|
|
83 |
st.write(snippets)
|
84 |
|
85 |
# openai.api_key = ""
|
86 |
+
openai.api_key = os.environ.getattribute('OPENAI_KEY') #os.environ['OPENAI_KEY']
|
87 |
|
88 |
def openai_response(PROMPT):
|
89 |
response = openai.Image.create(
|