mikemoz commited on
Commit
dd23ac0
1 Parent(s): 16c7043

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -11,7 +11,10 @@ udio_auth_token = os.getenv("UDIO_API_KEY")
11
  udio_wrapper = UdioWrapper(udio_auth_token)
12
 
13
 
14
- def run_agent(role, goal, backstory, task_description, expected_output):
 
 
 
15
  # Create agent with user-specified parameters
16
  general_agent = Agent(
17
  role=role,
@@ -43,7 +46,7 @@ def run_agent(role, goal, backstory, task_description, expected_output):
43
  #song_path = song[0]['song_path']
44
 
45
  #return [result,song_path]
46
- return song
47
 
48
  def make_song(task_description, result):
49
  song = udio_wrapper.create_song(prompt=task_description,custom_lyrics=result)
@@ -53,6 +56,7 @@ def make_song(task_description, result):
53
  with gr.Blocks() as demo:
54
  gr.Markdown("# Agent and Task Configuration")
55
 
 
56
  role = gr.Textbox(label="Role of the Agent", placeholder="Enter the role of your agent")
57
  goal = gr.Textbox(label="Goal of the Agent", placeholder="Enter the goal of your agent")
58
  backstory = gr.Textbox(label="Backstory of the Agent", placeholder="Enter the backstory of your agent")
@@ -68,7 +72,7 @@ with gr.Blocks() as demo:
68
 
69
  submit_button.click(
70
  fn=run_agent,
71
- inputs=[role, goal, backstory, task_description, expected_output],
72
  #outputs=[result,player]
73
  outputs=result
74
  )
 
11
  udio_wrapper = UdioWrapper(udio_auth_token)
12
 
13
 
14
+ def run_agent(pw,role, goal, backstory, task_description, expected_output):
15
+ if pw != os.getenv("PW"):
16
+ raise gr.Error("Invalid password. Please try again.")
17
+
18
  # Create agent with user-specified parameters
19
  general_agent = Agent(
20
  role=role,
 
46
  #song_path = song[0]['song_path']
47
 
48
  #return [result,song_path]
49
+ return result
50
 
51
  def make_song(task_description, result):
52
  song = udio_wrapper.create_song(prompt=task_description,custom_lyrics=result)
 
56
  with gr.Blocks() as demo:
57
  gr.Markdown("# Agent and Task Configuration")
58
 
59
+ pw = gr.Textbox(label="Password", type="password", placeholder="Enter the password")
60
  role = gr.Textbox(label="Role of the Agent", placeholder="Enter the role of your agent")
61
  goal = gr.Textbox(label="Goal of the Agent", placeholder="Enter the goal of your agent")
62
  backstory = gr.Textbox(label="Backstory of the Agent", placeholder="Enter the backstory of your agent")
 
72
 
73
  submit_button.click(
74
  fn=run_agent,
75
+ inputs=[pw,role, goal, backstory, task_description, expected_output],
76
  #outputs=[result,player]
77
  outputs=result
78
  )