Spaces:
Runtime error
Runtime error
zwq2018
commited on
Commit
·
864c124
1
Parent(s):
962f69c
change openai
Browse files- .idea/Data-Copilot.iml +4 -0
- app.py +2 -2
- lab_gpt4_call.py +1 -0
- main.py +1 -1
.idea/Data-Copilot.iml
CHANGED
@@ -5,4 +5,8 @@
|
|
5 |
<orderEntry type="inheritedJdk" />
|
6 |
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
</component>
|
|
|
|
|
|
|
|
|
8 |
</module>
|
|
|
5 |
<orderEntry type="inheritedJdk" />
|
6 |
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
</component>
|
8 |
+
<component name="PyDocumentationSettings">
|
9 |
+
<option name="format" value="GOOGLE" />
|
10 |
+
<option name="myDocStringFormat" value="Google" />
|
11 |
+
</component>
|
12 |
</module>
|
app.py
CHANGED
@@ -50,8 +50,8 @@ class Client:
|
|
50 |
def run(self, messages):
|
51 |
|
52 |
# self.stop = False
|
53 |
-
self.OPENAI_KEY =
|
54 |
-
self.OPENAI_API_KEY_AZURE = os.getenv('OPENAI_API_KEY_AZURE')
|
55 |
self.OPENAI_API_BASED_AZURE = os.getenv('OPENAI_API_BASED_AZURE')
|
56 |
self.OPENAI_ENGINE_AZURE = os.getenv('OPENAI_ENGINE_AZURE')
|
57 |
gen = gradio_interface(messages, self.OPENAI_KEY, self.OPENAI_API_KEY_AZURE, self.OPENAI_API_BASED_AZURE, self.OPENAI_ENGINE_AZURE)
|
|
|
50 |
def run(self, messages):
|
51 |
|
52 |
# self.stop = False
|
53 |
+
self.OPENAI_KEY = os.getenv('OPENAI_API')
|
54 |
+
self.OPENAI_API_KEY_AZURE = ''#os.getenv('OPENAI_API_KEY_AZURE')
|
55 |
self.OPENAI_API_BASED_AZURE = os.getenv('OPENAI_API_BASED_AZURE')
|
56 |
self.OPENAI_ENGINE_AZURE = os.getenv('OPENAI_ENGINE_AZURE')
|
57 |
gen = gradio_interface(messages, self.OPENAI_KEY, self.OPENAI_API_KEY_AZURE, self.OPENAI_API_BASED_AZURE, self.OPENAI_ENGINE_AZURE)
|
lab_gpt4_call.py
CHANGED
@@ -148,6 +148,7 @@ def send_official_call(query, openai_key='', api_base='', engine=''):
|
|
148 |
start = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start))
|
149 |
print(start)
|
150 |
openai.api_key = openai_key
|
|
|
151 |
|
152 |
response = openai.ChatCompletion.create(
|
153 |
# engine="gpt35",
|
|
|
148 |
start = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start))
|
149 |
print(start)
|
150 |
openai.api_key = openai_key
|
151 |
+
openai.api_base = api_base
|
152 |
|
153 |
response = openai.ChatCompletion.create(
|
154 |
# engine="gpt35",
|
main.py
CHANGED
@@ -370,7 +370,7 @@ def gradio_interface(query, openai_key, openai_key_azure, api_base, engine):
|
|
370 |
try:
|
371 |
if openai_key.startswith('sk') and openai_key_azure == '':
|
372 |
print('send_official_call')
|
373 |
-
thread = MyThread(target=run, args=(query, add_to_queue, send_official_call, openai_key))
|
374 |
elif openai_key =='' and len(openai_key_azure)>0:
|
375 |
print('send_chat_request_Azure')
|
376 |
thread = MyThread(target=run, args=(query, add_to_queue, send_chat_request_Azure, openai_key_azure, api_base, engine))
|
|
|
370 |
try:
|
371 |
if openai_key.startswith('sk') and openai_key_azure == '':
|
372 |
print('send_official_call')
|
373 |
+
thread = MyThread(target=run, args=(query, add_to_queue, send_official_call, openai_key, api_base))
|
374 |
elif openai_key =='' and len(openai_key_azure)>0:
|
375 |
print('send_chat_request_Azure')
|
376 |
thread = MyThread(target=run, args=(query, add_to_queue, send_chat_request_Azure, openai_key_azure, api_base, engine))
|