yuntian-deng commited on
Commit
8e7ba9f
1 Parent(s): 3a30fdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,6 +6,7 @@ import requests
6
 
7
  #Streaming endpoint
8
  API_URL = os.getenv("API_URL")
 
9
 
10
  #Testing with my Open AI Key
11
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
@@ -103,6 +104,8 @@ def reset_textbox():
103
  return gr.update(value='')
104
 
105
  title = """<h1 align="center">🔥GPT4 with ChatCompletions API +🚀Gradio-Streaming</h1>"""
 
 
106
  description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
107
  ```
108
  User: <utterance>
@@ -130,7 +133,7 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
130
  state = gr.State([]) #s
131
  with gr.Row():
132
  with gr.Column(scale=7):
133
- b1 = gr.Button().style(full_width=True)
134
  with gr.Column(scale=3):
135
  server_status_code = gr.Textbox(label="Status code from OpenAI server", )
136
 
 
6
 
7
  #Streaming endpoint
8
  API_URL = os.getenv("API_URL")
9
+ DISABLED = os.getenv("DISABLED") == 'True'
10
 
11
  #Testing with my Open AI Key
12
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
 
104
  return gr.update(value='')
105
 
106
  title = """<h1 align="center">🔥GPT4 with ChatCompletions API +🚀Gradio-Streaming</h1>"""
107
+ if DISABLED:
108
+ title = """This app has reached OpenAI's usage limit. We are currently requesting an increase in our quota. Please check back in a few days."""
109
  description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
110
  ```
111
  User: <utterance>
 
133
  state = gr.State([]) #s
134
  with gr.Row():
135
  with gr.Column(scale=7):
136
+ b1 = gr.Button(visible=not DISABLED).style(full_width=True)
137
  with gr.Column(scale=3):
138
  server_status_code = gr.Textbox(label="Status code from OpenAI server", )
139