Spaces:
Paused
Paused
Commit
·
558e9ac
1
Parent(s):
5c4e310
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import os
|
|
|
|
| 3 |
import json
|
| 4 |
import requests
|
| 5 |
|
|
@@ -7,7 +8,12 @@ import requests
|
|
| 7 |
API_URL = "https://api.openai.com/v1/chat/completions" #os.getenv("API_URL") + "/generate_stream"
|
| 8 |
|
| 9 |
#Testing with my Open AI Key
|
| 10 |
-
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def predict(inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
| 13 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
import json
|
| 5 |
import requests
|
| 6 |
|
|
|
|
| 8 |
API_URL = "https://api.openai.com/v1/chat/completions" #os.getenv("API_URL") + "/generate_stream"
|
| 9 |
|
| 10 |
#Testing with my Open AI Key
|
| 11 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 12 |
+
|
| 13 |
+
#Supress errors
|
| 14 |
+
def exception_handler(exception_type, exception, traceback):
|
| 15 |
+
print("%s: %s" % (exception_type.__name__, exception))
|
| 16 |
+
sys.excepthook = exception_handler
|
| 17 |
|
| 18 |
def predict(inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
| 19 |
|