Spaces:
Runtime error
Runtime error
styling, handle runpod connection errors
Browse files
app.py
CHANGED
@@ -95,14 +95,17 @@ class Pipeline:
|
|
95 |
}
|
96 |
|
97 |
while True:
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
106 |
|
107 |
def poll_for_status(self, task_id):
|
108 |
url = f"https://api.runpod.ai/v2/{self.endpoint_id}/status/{task_id}"
|
@@ -543,7 +546,7 @@ with gr.Blocks() as arena:
|
|
543 |
with gr.Tab("OAAIC Chatbots"):
|
544 |
gr.Markdown("# GGML Spaces Chatbot Demo")
|
545 |
open_model_choice = gr.Dropdown(label="Model", choices=OAAIC_MODELS, value=OAAIC_MODELS[0])
|
546 |
-
open_chatbot = gr.Chatbot()
|
547 |
with gr.Row():
|
548 |
open_message = gr.Textbox(
|
549 |
label="What do you want to chat about?",
|
|
|
95 |
}
|
96 |
|
97 |
while True:
|
98 |
+
try:
|
99 |
+
response = requests.get(url, headers=headers)
|
100 |
+
if response.status_code == 200:
|
101 |
+
data = response.json()
|
102 |
+
yield [{"generated_text": "".join([s["output"] for s in data["stream"]])}]
|
103 |
+
if data.get('status') == 'COMPLETED':
|
104 |
+
return
|
105 |
+
elif response.status_code >= 400:
|
106 |
+
logging.error(response.json())
|
107 |
+
except ConnectionError:
|
108 |
+
pass
|
109 |
|
110 |
def poll_for_status(self, task_id):
|
111 |
url = f"https://api.runpod.ai/v2/{self.endpoint_id}/status/{task_id}"
|
|
|
546 |
with gr.Tab("OAAIC Chatbots"):
|
547 |
gr.Markdown("# GGML Spaces Chatbot Demo")
|
548 |
open_model_choice = gr.Dropdown(label="Model", choices=OAAIC_MODELS, value=OAAIC_MODELS[0])
|
549 |
+
open_chatbot = gr.Chatbot().style(height=400)
|
550 |
with gr.Row():
|
551 |
open_message = gr.Textbox(
|
552 |
label="What do you want to chat about?",
|