Spaces:
Paused
Paused
Commit
Β·
7da7107
1
Parent(s):
54005f1
fixed auth issue
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ auth_manager = AuthManager()
|
|
| 43 |
|
| 44 |
# Main generation function
|
| 45 |
@spaces.GPU(duration=180)
|
| 46 |
-
def generate_monster(oauth_profile, audio_input=None, text_input=None, reference_images=None,
|
| 47 |
training_focus="balanced", care_level="normal"):
|
| 48 |
"""Generate a new monster with AI pipeline"""
|
| 49 |
|
|
@@ -56,7 +56,7 @@ def generate_monster(oauth_profile, audio_input=None, text_input=None, reference
|
|
| 56 |
"dialogue": None
|
| 57 |
}
|
| 58 |
|
| 59 |
-
user_id = oauth_profile.username
|
| 60 |
|
| 61 |
try:
|
| 62 |
# Generate monster using AI pipeline
|
|
@@ -98,13 +98,13 @@ def generate_monster(oauth_profile, audio_input=None, text_input=None, reference
|
|
| 98 |
}
|
| 99 |
|
| 100 |
# Training function
|
| 101 |
-
def train_monster(oauth_profile, training_type, intensity):
|
| 102 |
"""Train the active monster"""
|
| 103 |
|
| 104 |
if oauth_profile is None:
|
| 105 |
return "π Please log in to train monsters!", None, None
|
| 106 |
|
| 107 |
-
user_id = oauth_profile.username
|
| 108 |
current_monster = state_manager.get_current_monster(user_id)
|
| 109 |
|
| 110 |
if not current_monster:
|
|
@@ -124,13 +124,13 @@ def train_monster(oauth_profile, training_type, intensity):
|
|
| 124 |
return result['message'], None, None
|
| 125 |
|
| 126 |
# Care functions
|
| 127 |
-
def feed_monster(oauth_profile, food_type):
|
| 128 |
"""Feed the active monster"""
|
| 129 |
|
| 130 |
if oauth_profile is None:
|
| 131 |
return "π Please log in to care for monsters!"
|
| 132 |
|
| 133 |
-
user_id = oauth_profile.username
|
| 134 |
current_monster = state_manager.get_current_monster(user_id)
|
| 135 |
|
| 136 |
if not current_monster:
|
|
@@ -366,7 +366,6 @@ with gr.Blocks(
|
|
| 366 |
generate_btn.click(
|
| 367 |
fn=generate_monster,
|
| 368 |
inputs=[
|
| 369 |
-
gr.State(lambda: gr.Request().username if hasattr(gr.Request(), 'username') else None),
|
| 370 |
audio_input,
|
| 371 |
text_input,
|
| 372 |
reference_images,
|
|
@@ -385,7 +384,6 @@ with gr.Blocks(
|
|
| 385 |
train_btn.click(
|
| 386 |
fn=train_monster,
|
| 387 |
inputs=[
|
| 388 |
-
gr.State(lambda: gr.Request().username if hasattr(gr.Request(), 'username') else None),
|
| 389 |
training_type,
|
| 390 |
training_intensity
|
| 391 |
],
|
|
@@ -399,7 +397,6 @@ with gr.Blocks(
|
|
| 399 |
feed_btn.click(
|
| 400 |
fn=feed_monster,
|
| 401 |
inputs=[
|
| 402 |
-
gr.State(lambda: gr.Request().username if hasattr(gr.Request(), 'username') else None),
|
| 403 |
food_type
|
| 404 |
],
|
| 405 |
outputs=[feeding_result]
|
|
|
|
| 43 |
|
| 44 |
# Main generation function
|
| 45 |
@spaces.GPU(duration=180)
|
| 46 |
+
def generate_monster(oauth_profile: gr.OAuthProfile | None, audio_input=None, text_input=None, reference_images=None,
|
| 47 |
training_focus="balanced", care_level="normal"):
|
| 48 |
"""Generate a new monster with AI pipeline"""
|
| 49 |
|
|
|
|
| 56 |
"dialogue": None
|
| 57 |
}
|
| 58 |
|
| 59 |
+
user_id = oauth_profile.username
|
| 60 |
|
| 61 |
try:
|
| 62 |
# Generate monster using AI pipeline
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
# Training function
|
| 101 |
+
def train_monster(oauth_profile: gr.OAuthProfile | None, training_type, intensity):
|
| 102 |
"""Train the active monster"""
|
| 103 |
|
| 104 |
if oauth_profile is None:
|
| 105 |
return "π Please log in to train monsters!", None, None
|
| 106 |
|
| 107 |
+
user_id = oauth_profile.username
|
| 108 |
current_monster = state_manager.get_current_monster(user_id)
|
| 109 |
|
| 110 |
if not current_monster:
|
|
|
|
| 124 |
return result['message'], None, None
|
| 125 |
|
| 126 |
# Care functions
|
| 127 |
+
def feed_monster(oauth_profile: gr.OAuthProfile | None, food_type):
|
| 128 |
"""Feed the active monster"""
|
| 129 |
|
| 130 |
if oauth_profile is None:
|
| 131 |
return "π Please log in to care for monsters!"
|
| 132 |
|
| 133 |
+
user_id = oauth_profile.username
|
| 134 |
current_monster = state_manager.get_current_monster(user_id)
|
| 135 |
|
| 136 |
if not current_monster:
|
|
|
|
| 366 |
generate_btn.click(
|
| 367 |
fn=generate_monster,
|
| 368 |
inputs=[
|
|
|
|
| 369 |
audio_input,
|
| 370 |
text_input,
|
| 371 |
reference_images,
|
|
|
|
| 384 |
train_btn.click(
|
| 385 |
fn=train_monster,
|
| 386 |
inputs=[
|
|
|
|
| 387 |
training_type,
|
| 388 |
training_intensity
|
| 389 |
],
|
|
|
|
| 397 |
feed_btn.click(
|
| 398 |
fn=feed_monster,
|
| 399 |
inputs=[
|
|
|
|
| 400 |
food_type
|
| 401 |
],
|
| 402 |
outputs=[feeding_result]
|