Spaces:
Running
Running
Commit
·
bc71765
1
Parent(s):
14fca09
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,12 @@ import sys
|
|
| 4 |
import json
|
| 5 |
import requests
|
| 6 |
|
| 7 |
-
MODEL = "gpt-4"
|
| 8 |
API_URL = os.getenv("API_URL")
|
| 9 |
DISABLED = os.getenv("DISABLED") == 'True'
|
| 10 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
| 11 |
NUM_THREADS = int(os.getenv("NUM_THREADS"))
|
| 12 |
|
| 13 |
print (NUM_THREADS)
|
|
@@ -119,9 +121,9 @@ def predict(inputs, top_p, temperature, chat_counter, chatbot, history, request:
|
|
| 119 |
def reset_textbox():
|
| 120 |
return gr.update(value='', interactive=False), gr.update(interactive=False)
|
| 121 |
|
| 122 |
-
title = """<h1 align="center">
|
| 123 |
if DISABLED:
|
| 124 |
-
title = """<h1 align="center" style="color:red">This app has reached OpenAI's usage limit.
|
| 125 |
description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
|
| 126 |
```
|
| 127 |
User: <utterance>
|
|
@@ -130,7 +132,7 @@ User: <utterance>
|
|
| 130 |
Assistant: <utterance>
|
| 131 |
...
|
| 132 |
```
|
| 133 |
-
In this app, you can explore the outputs of a gpt-4 LLM.
|
| 134 |
"""
|
| 135 |
|
| 136 |
theme = gr.themes.Default(primary_hue="green")
|
|
@@ -139,8 +141,9 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
|
|
| 139 |
#chatbot {height: 520px; overflow: auto;}""",
|
| 140 |
theme=theme) as demo:
|
| 141 |
gr.HTML(title)
|
| 142 |
-
#gr.HTML("""<h3 align="center">This app provides you full access to
|
| 143 |
-
gr.HTML("""<h3 align="center" style="color: red;">If this app is too busy, consider trying our GPT-
|
|
|
|
| 144 |
|
| 145 |
#gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/ChatGPT4?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
|
| 146 |
with gr.Column(elem_id = "col_container", visible=False) as main_block:
|
|
|
|
| 4 |
import json
|
| 5 |
import requests
|
| 6 |
|
| 7 |
+
MODEL = "gpt-4-1106-preview"
|
| 8 |
API_URL = os.getenv("API_URL")
|
| 9 |
DISABLED = os.getenv("DISABLED") == 'True'
|
| 10 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 11 |
+
print (API_URL)
|
| 12 |
+
print (OPENAI_API_KEY)
|
| 13 |
NUM_THREADS = int(os.getenv("NUM_THREADS"))
|
| 14 |
|
| 15 |
print (NUM_THREADS)
|
|
|
|
| 121 |
def reset_textbox():
|
| 122 |
return gr.update(value='', interactive=False), gr.update(interactive=False)
|
| 123 |
|
| 124 |
+
title = """<h1 align="center">GPT-4 Turbo: Research Preview (128K token limit, Short-Term Availability)</h1>"""
|
| 125 |
if DISABLED:
|
| 126 |
+
title = """<h1 align="center" style="color:red">This app has reached OpenAI's usage limit. Please check back tomorrow.</h1>"""
|
| 127 |
description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
|
| 128 |
```
|
| 129 |
User: <utterance>
|
|
|
|
| 132 |
Assistant: <utterance>
|
| 133 |
...
|
| 134 |
```
|
| 135 |
+
In this app, you can explore the outputs of a gpt-4 turbo LLM.
|
| 136 |
"""
|
| 137 |
|
| 138 |
theme = gr.themes.Default(primary_hue="green")
|
|
|
|
| 141 |
#chatbot {height: 520px; overflow: auto;}""",
|
| 142 |
theme=theme) as demo:
|
| 143 |
gr.HTML(title)
|
| 144 |
+
#gr.HTML("""<h3 align="center">This app provides you full access to GPT-4 Turbo (128K token limit). You don't need any OPENAI API key.</h1>""")
|
| 145 |
+
#gr.HTML("""<h3 align="center" style="color: red;">If this app is too busy, consider trying our GPT-3.5 app, which has a much shorter queue time. Visit it below:<br/><a href="https://huggingface.co/spaces/yuntian-deng/ChatGPT">https://huggingface.co/spaces/yuntian-deng/ChatGPT</a></h3>""")
|
| 146 |
+
gr.HTML("""<h3 align="center" style="color: red;">If this app doesn't respond, it's likely due to our API key hitting the daily limit of our organization. Consider trying our GPT-3.5 app:<br/><a href="https://huggingface.co/spaces/yuntian-deng/ChatGPT">https://huggingface.co/spaces/yuntian-deng/ChatGPT</a></h3>""")
|
| 147 |
|
| 148 |
#gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/ChatGPT4?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
|
| 149 |
with gr.Column(elem_id = "col_container", visible=False) as main_block:
|