Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -44,11 +44,16 @@ def init_app(api_key,
|
|
| 44 |
tootbot_app = TootBot(model=model_name,
|
| 45 |
model_class=model_class,
|
| 46 |
temperature=temperature)
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
| 49 |
redirect_uri="http://localhost:8080",
|
| 50 |
-
client_id="
|
| 51 |
-
to_file="
|
|
|
|
|
|
|
| 52 |
os.environ["OPENAI_API_KEY"] = api_key
|
| 53 |
os.environ["OPENAI_API_KEY_2"] = api_key
|
| 54 |
tootbot_app.init_models(diffusion_model=diffusion_model,
|
|
|
|
| 44 |
tootbot_app = TootBot(model=model_name,
|
| 45 |
model_class=model_class,
|
| 46 |
temperature=temperature)
|
| 47 |
+
with open("client_cred.secret", "w") as file:
|
| 48 |
+
file.write(os.getenv("MASTODON_CLIENT_SECRET"))
|
| 49 |
+
file.close()
|
| 50 |
+
tootbot_app.mastodon_login(username=os.getenv("MASTODON_USERNAME"),
|
| 51 |
+
password=os.getenv("MASTODON_PASSWORD"),
|
| 52 |
redirect_uri="http://localhost:8080",
|
| 53 |
+
client_id="client_cred.secret",
|
| 54 |
+
to_file="usercred.secret")
|
| 55 |
+
os.remove("usercred.secret")
|
| 56 |
+
os.remove("client_cred.secret")
|
| 57 |
os.environ["OPENAI_API_KEY"] = api_key
|
| 58 |
os.environ["OPENAI_API_KEY_2"] = api_key
|
| 59 |
tootbot_app.init_models(diffusion_model=diffusion_model,
|