Spaces:
Sleeping
Sleeping
dongyubin
commited on
Commit
·
67b4536
1
Parent(s):
ec43c4f
更新
Browse files
app.py
CHANGED
@@ -20,8 +20,14 @@ def main():
|
|
20 |
|
21 |
def my_inference_function(enabled, api_key, api_base, url):
|
22 |
if enabled:
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
llm = OpenAI(temperature=0.7, model_name="gpt-3.5-turbo", max_tokens=1024)
|
26 |
else:
|
27 |
llm = HuggingFaceHub(repo_id="declare-lab/flan-alpaca-large", model_kwargs={"temperature":0.1, "max_length":512})
|
|
|
20 |
|
21 |
def my_inference_function(enabled, api_key, api_base, url):
|
22 |
if enabled:
|
23 |
+
if api_key:
|
24 |
+
os.environ["OPENAI_API_KEY"] = api_key
|
25 |
+
else:
|
26 |
+
os.environ.pop("OPENAI_API_KEY", None)
|
27 |
+
if api_base:
|
28 |
+
os.environ['OPENAI_API_BASE'] = api_base
|
29 |
+
else:
|
30 |
+
os.environ.pop('OPENAI_API_BASE', None)
|
31 |
llm = OpenAI(temperature=0.7, model_name="gpt-3.5-turbo", max_tokens=1024)
|
32 |
else:
|
33 |
llm = HuggingFaceHub(repo_id="declare-lab/flan-alpaca-large", model_kwargs={"temperature":0.1, "max_length":512})
|