Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ from BotSimulator import TootBot
|
|
| 8 |
import openai
|
| 9 |
from io import StringIO
|
| 10 |
import multiprocessing
|
| 11 |
-
restore_point=sys.stdout
|
| 12 |
|
| 13 |
|
| 14 |
if not os.path.exists("data/fake-tweets"):
|
|
@@ -42,7 +42,7 @@ def init_app(api_key,
|
|
| 42 |
openai.api_key = api_key
|
| 43 |
openai.Model.list()
|
| 44 |
except Exception as e:
|
| 45 |
-
gr.Error(str(e))
|
| 46 |
|
| 47 |
console_logs = StringIO()
|
| 48 |
sys.stdout = console_logs
|
|
@@ -92,7 +92,7 @@ def run_simulation(topic,
|
|
| 92 |
news_company="CNN",
|
| 93 |
text_model_name="gpt-3.5-turbo-0301"):
|
| 94 |
if topic == "":
|
| 95 |
-
gr.Error("Topic must not be empty")
|
| 96 |
|
| 97 |
console_logs = StringIO()
|
| 98 |
sys.stdout = console_logs
|
|
|
|
| 8 |
import openai
|
| 9 |
from io import StringIO
|
| 10 |
import multiprocessing
|
| 11 |
+
restore_point = sys.stdout
|
| 12 |
|
| 13 |
|
| 14 |
if not os.path.exists("data/fake-tweets"):
|
|
|
|
| 42 |
openai.api_key = api_key
|
| 43 |
openai.Model.list()
|
| 44 |
except Exception as e:
|
| 45 |
+
raise gr.Error("Invalid API Key... " + str(e))
|
| 46 |
|
| 47 |
console_logs = StringIO()
|
| 48 |
sys.stdout = console_logs
|
|
|
|
| 92 |
news_company="CNN",
|
| 93 |
text_model_name="gpt-3.5-turbo-0301"):
|
| 94 |
if topic == "":
|
| 95 |
+
raise gr.Error("Topic must not be empty")
|
| 96 |
|
| 97 |
console_logs = StringIO()
|
| 98 |
sys.stdout = console_logs
|