Spaces:
Sleeping
Fixed some part of your code
Here is the working code for your reference Dave.
https://huggingface.co/spaces/louiecerv/LemmaTeks
I noticed that you changed from some other model most like openAI Llama to Gemini.
There were a number of things keeping your code from working. The main reason is that you were trying to use the Gemini app as the endpoint. You can't send an API call to the Gemini app because it is the Google UI for Gemini. Also the structure of the call is for openAI and not compatible with Gemini. You will understand this better if you put my code side by side with your original. The multiple outputs from one prompt is currently not supported on the Gemini API. If you really need multiple outputs, you will have to make as many API call as you need. Refer to these pages for documentation:
https://ai.google.dev/gemini-api/docs/text-generation?lang=python#configure
I would assume you have obtained your Gemini API from the AI studio:
https://aistudio.google.com/u/1/apikey
You can use your method of passing the streamlit secret. It should work the same as my approach that uses the getenv() function.
To continue improving your work, you can duplicate my version and modify your copy.
Enjoy coding!
Thank you for the helpful response, sir! I am still figuring out the errors on the OpenAi model, that's why I am changing the model to Gemini to compare both.