Spaces:
Runtime error
Runtime error
tricktreat
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -130,46 +130,46 @@ with gr.Blocks(css=css) as demo:
|
|
130 |
gr.HTML('''<center><a href="https://huggingface.co/spaces/microsoft/HuggingGPT?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key and Hugging Face Token</center>''')
|
131 |
gr.HTML('''<center>Note: Only a few models are deployed in the local inference endpoint due to hardware limitations. In addition, online HuggingFace inference endpoints may sometimes not be available. Thus the capability of HuggingGPT is limited.</center>''')
|
132 |
if not OPENAI_KEY:
|
133 |
-
with gr.Row()
|
134 |
with gr.Column(scale=0.85):
|
135 |
openai_api_key = gr.Textbox(
|
136 |
show_label=False,
|
137 |
placeholder="Set your OpenAI API key here and press Enter",
|
138 |
lines=1,
|
139 |
-
type="password"
|
140 |
-
|
141 |
with gr.Column(scale=0.15, min_width=0):
|
142 |
-
btn1 = gr.Button("Submit"
|
143 |
|
144 |
if not HUGGINGFACE_TOKEN:
|
145 |
-
with gr.Row()
|
146 |
with gr.Column(scale=0.85):
|
147 |
hugging_face_token = gr.Textbox(
|
148 |
show_label=False,
|
149 |
placeholder="Set your Hugging Face Token here and press Enter",
|
150 |
lines=1,
|
151 |
-
type="password"
|
152 |
-
|
153 |
with gr.Column(scale=0.15, min_width=0):
|
154 |
-
btn3 = gr.Button("Submit"
|
155 |
|
156 |
|
157 |
-
with gr.Row()
|
158 |
with gr.Column(scale=0.6):
|
159 |
-
chatbot = gr.Chatbot([], elem_id="chatbot"
|
160 |
with gr.Column(scale=0.4):
|
161 |
results = gr.JSON(elem_classes="json")
|
162 |
|
163 |
|
164 |
-
with gr.Row()
|
165 |
with gr.Column(scale=0.85):
|
166 |
txt = gr.Textbox(
|
167 |
show_label=False,
|
168 |
placeholder="Enter text and press enter. The url must contain the media type. e.g, https://example.com/example.jpg",
|
169 |
lines=1,
|
170 |
-
|
171 |
with gr.Column(scale=0.15, min_width=0):
|
172 |
-
btn2 = gr.Button("Send"
|
173 |
|
174 |
def set_key(state, openai_api_key):
|
175 |
return state["client"].set_key(openai_api_key)
|
|
|
130 |
gr.HTML('''<center><a href="https://huggingface.co/spaces/microsoft/HuggingGPT?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key and Hugging Face Token</center>''')
|
131 |
gr.HTML('''<center>Note: Only a few models are deployed in the local inference endpoint due to hardware limitations. In addition, online HuggingFace inference endpoints may sometimes not be available. Thus the capability of HuggingGPT is limited.</center>''')
|
132 |
if not OPENAI_KEY:
|
133 |
+
with gr.Row():
|
134 |
with gr.Column(scale=0.85):
|
135 |
openai_api_key = gr.Textbox(
|
136 |
show_label=False,
|
137 |
placeholder="Set your OpenAI API key here and press Enter",
|
138 |
lines=1,
|
139 |
+
type="password",
|
140 |
+
container=False)
|
141 |
with gr.Column(scale=0.15, min_width=0):
|
142 |
+
btn1 = gr.Button("Submit", full_height=True)
|
143 |
|
144 |
if not HUGGINGFACE_TOKEN:
|
145 |
+
with gr.Row():
|
146 |
with gr.Column(scale=0.85):
|
147 |
hugging_face_token = gr.Textbox(
|
148 |
show_label=False,
|
149 |
placeholder="Set your Hugging Face Token here and press Enter",
|
150 |
lines=1,
|
151 |
+
type="password",
|
152 |
+
container=False)
|
153 |
with gr.Column(scale=0.15, min_width=0):
|
154 |
+
btn3 = gr.Button("Submit", full_height=True)
|
155 |
|
156 |
|
157 |
+
with gr.Row():
|
158 |
with gr.Column(scale=0.6):
|
159 |
+
chatbot = gr.Chatbot([], elem_id="chatbot", height=500)
|
160 |
with gr.Column(scale=0.4):
|
161 |
results = gr.JSON(elem_classes="json")
|
162 |
|
163 |
|
164 |
+
with gr.Row():
|
165 |
with gr.Column(scale=0.85):
|
166 |
txt = gr.Textbox(
|
167 |
show_label=False,
|
168 |
placeholder="Enter text and press enter. The url must contain the media type. e.g, https://example.com/example.jpg",
|
169 |
lines=1,
|
170 |
+
container=False)
|
171 |
with gr.Column(scale=0.15, min_width=0):
|
172 |
+
btn2 = gr.Button("Send", full_height=True)
|
173 |
|
174 |
def set_key(state, openai_api_key):
|
175 |
return state["client"].set_key(openai_api_key)
|