Spaces:
Sleeping
Sleeping
gera
commited on
Commit
·
6a7b15a
1
Parent(s):
da1daec
gpt-4-plus and authentication
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from openai import OpenAI
|
| 3 |
import os
|
| 4 |
-
import
|
| 5 |
|
| 6 |
api_key = os.getenv("OPENAI_APIKEY")
|
| 7 |
client = OpenAI(api_key=api_key)
|
|
@@ -18,7 +18,7 @@ def chat(message, history):
|
|
| 18 |
print(f"{history}\n----\n{message}\n----\n{history_openai_format}")
|
| 19 |
|
| 20 |
response = client.chat.completions.create(
|
| 21 |
-
model='gpt-
|
| 22 |
messages= history_openai_format,
|
| 23 |
temperature=1.0,
|
| 24 |
stream=True)
|
|
@@ -35,4 +35,6 @@ demo = gr.ChatInterface(
|
|
| 35 |
title="Summarization and more",
|
| 36 |
multimodal=True)
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from openai import OpenAI
|
| 3 |
import os
|
| 4 |
+
import json
|
| 5 |
|
| 6 |
api_key = os.getenv("OPENAI_APIKEY")
|
| 7 |
client = OpenAI(api_key=api_key)
|
|
|
|
| 18 |
print(f"{history}\n----\n{message}\n----\n{history_openai_format}")
|
| 19 |
|
| 20 |
response = client.chat.completions.create(
|
| 21 |
+
model='gpt-4-turbo',
|
| 22 |
messages= history_openai_format,
|
| 23 |
temperature=1.0,
|
| 24 |
stream=True)
|
|
|
|
| 35 |
title="Summarization and more",
|
| 36 |
multimodal=True)
|
| 37 |
|
| 38 |
+
auth=os.environ.get("APP_USERS", "None")
|
| 39 |
+
auth=json.loads(auth)
|
| 40 |
+
demo.launch(auth=auth)
|