Skip to content

Commit

Permalink
Fix pricing for multiple outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Feb 20, 2024
1 parent f82d5f4 commit 1b3ca5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion recipes/CompareText2Img.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,4 @@ def get_raw_price(self, state: dict) -> int:
total += 15
case _:
total += 2
return total
return total * state.get("num_outputs", 1)
3 changes: 3 additions & 0 deletions recipes/GoogleGPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,6 @@ def run_v2(
max_tokens=request.max_tokens,
avoid_repetition=request.avoid_repetition,
)

def get_raw_price(self, state: dict) -> float:
return self.price * state.get("num_outputs", 1)
6 changes: 4 additions & 2 deletions recipes/VideoBots.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,13 @@ def get_raw_price(self, state: dict):
"raw_tts_text", state.get("raw_output_text", [])
)
tts_state = {"text_prompt": "".join(output_text_list)}
return super().get_raw_price(state) + TextToSpeechPage().get_raw_price(
total = super().get_raw_price(state) + TextToSpeechPage().get_raw_price(
tts_state
)
case _:
return super().get_raw_price(state)
total = super().get_raw_price(state)

return total * state.get("num_outputs", 1)

def additional_notes(self):
tts_provider = st.session_state.get("tts_provider")
Expand Down

0 comments on commit 1b3ca5b

Please sign in to comment.