Commit ยท
00770ab
1
Parent(s): 28b5f8e
Update blubeAPI.py
Browse files- blubeAPI.py +2 -0
blubeAPI.py
CHANGED
|
@@ -33,6 +33,7 @@ def format(data: str):
|
|
| 33 |
data[index:lindex] = ""
|
| 34 |
return data
|
| 35 |
def runbot():
|
|
|
|
| 36 |
iface = gr.Interface(fn=chatbot,
|
| 37 |
inputs=gr.components.Textbox(lines=7, label="Enter your text"),
|
| 38 |
outputs="text",
|
|
@@ -138,6 +139,7 @@ def chatbot(input_text):
|
|
| 138 |
if ttime > 20:
|
| 139 |
print("\n\n\nTAKEN OVER 20 SECONDS, RESTARTING PROCESS\n\n\n")
|
| 140 |
client.beta.threads.delete(thread.id)
|
|
|
|
| 141 |
runbot()
|
| 142 |
if errorCode == 1:
|
| 143 |
raise RuntimeError("\n\nThe process finished with an error: Process failed unexpectedly. Check the command prompt for more details. This error is most likely a overuse error, so the program will sleep for 20 seconds to avoid more errors\n\n")
|
|
|
|
| 33 |
data[index:lindex] = ""
|
| 34 |
return data
|
| 35 |
def runbot():
|
| 36 |
+
global iface
|
| 37 |
iface = gr.Interface(fn=chatbot,
|
| 38 |
inputs=gr.components.Textbox(lines=7, label="Enter your text"),
|
| 39 |
outputs="text",
|
|
|
|
| 139 |
if ttime > 20:
|
| 140 |
print("\n\n\nTAKEN OVER 20 SECONDS, RESTARTING PROCESS\n\n\n")
|
| 141 |
client.beta.threads.delete(thread.id)
|
| 142 |
+
iface.close()
|
| 143 |
runbot()
|
| 144 |
if errorCode == 1:
|
| 145 |
raise RuntimeError("\n\nThe process finished with an error: Process failed unexpectedly. Check the command prompt for more details. This error is most likely a overuse error, so the program will sleep for 20 seconds to avoid more errors\n\n")
|