Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -131,9 +131,9 @@ def run_llm(
|
|
| 131 |
prompt_tokens = usage.prompt_tokens
|
| 132 |
completion_tokens = usage.completion_tokens
|
| 133 |
total_tokens = usage.total_tokens
|
| 134 |
-
token_message = f"Prompt: {prompt_tokens}, Completion: {completion_tokens}, Total: {total_tokens}
|
| 135 |
else:
|
| 136 |
-
token_message = f"Token info unavailable
|
| 137 |
|
| 138 |
full_content = completion.choices[0].message.content.strip()
|
| 139 |
main_msg, feedback_msg = split_main_and_feedback(full_content)
|
|
@@ -261,7 +261,7 @@ This tool was created by [Organizing for Change](https://www.organizingforchange
|
|
| 261 |
label="Token Usage",
|
| 262 |
interactive=False,
|
| 263 |
value="Tokens exchanged will appear here.",
|
| 264 |
-
info="See <a href='https://platform.openai.com/docs/pricing' target='_blank'>OpenAI pricing details</a> and <a href='https://epoch.ai/gradient-updates/how-much-energy-does-chatgpt-use' target='_blank'>How much energy does ChatGPT use?</a>."
|
| 265 |
)
|
| 266 |
|
| 267 |
# --- Connect submit button after outputs are created ---
|
|
@@ -272,4 +272,4 @@ This tool was created by [Organizing for Change](https://www.organizingforchange
|
|
| 272 |
)
|
| 273 |
|
| 274 |
if __name__ == "__main__":
|
| 275 |
-
demo.launch(share=True)
|
|
|
|
| 131 |
prompt_tokens = usage.prompt_tokens
|
| 132 |
completion_tokens = usage.completion_tokens
|
| 133 |
total_tokens = usage.total_tokens
|
| 134 |
+
token_message = f"Prompt: {prompt_tokens}, Completion: {completion_tokens}, Total: {total_tokens}"
|
| 135 |
else:
|
| 136 |
+
token_message = f"Token info unavailable"
|
| 137 |
|
| 138 |
full_content = completion.choices[0].message.content.strip()
|
| 139 |
main_msg, feedback_msg = split_main_and_feedback(full_content)
|
|
|
|
| 261 |
label="Token Usage",
|
| 262 |
interactive=False,
|
| 263 |
value="Tokens exchanged will appear here.",
|
| 264 |
+
info="See <a href='https://platform.openai.com/docs/pricing' target='_blank'>OpenAI pricing details</a> and <a href='https://epoch.ai/gradient-updates/how-much-energy-does-chatgpt-use' target='_blank'>How much energy does ChatGPT use?</a> for information about token cost and energy usage."
|
| 265 |
)
|
| 266 |
|
| 267 |
# --- Connect submit button after outputs are created ---
|
|
|
|
| 272 |
)
|
| 273 |
|
| 274 |
if __name__ == "__main__":
|
| 275 |
+
demo.launch(share=True)
|