Hi, I have built a Gemini 2.0 flash based photo editing app with gradio ui. This app is running perfectly fine on my local system, but when I am trying to run it on spaces it is giving me Error : No API Found .
I have used gemini api keys in secrects
Code :
https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py
Please let me know your thoughts, on how to resolve this. Thanks
2 Likes
First of all, it doesn’t seem to be a problem with the code.
It seems that installing google genai causes an error in Starlette and breaks Gradio…
I’m currently looking for a workaround.
Edit:
There seems to be some other condition.
I couldn’t avoid it…
But it’s probably just a bug, so it’ll be fixed eventually…
import gradio as gr
#from google import genai
#from google.genai import types
def generate_image():
return None
with gr.Blocks(title="Image Generation and Editing App") as app:
generate_button = gr.Button("Generate")
generated_output = gr.Image(label="Generated Image")
#generated_output = gr.Textbox(label="Generated Text") # this works
generate_button.click(fn=generate_image, inputs=None, outputs=[generated_output])
app.queue().launch(ssr_mode=False)
python-dotenv
google-genai
1 Like
pp1
March 18, 2025, 1:48pm
4
Is there a workaround for now. Im also getting the same issue
TypeError: argument of type ‘bool’ is not iterable
1 Like
Hmm… This space works…
google-genai==1.5.0
gradio
pydantic==2.10.6
3 Likes
pp1
March 18, 2025, 4:58pm
6
It works now. Thanks so much. Updating the requirements.txt file did the trick.
1 Like
It worked for me with below updates in requirement.txt
google-genai==1.5.0
gradio
pydantic==2.10.6
python-dotenv
1 Like
i am getting the same error on groq api, can anyone help me out iin this
1 Like
I seem to be getting the same error. No API Found
. I don’t even have an API used in the whole repo. I do have openai-whisper key in the secrets, but I am not using it anywhere.
requirements.txt file
deep_translator
gradio==5.6.0
pillow==11.0.0
pytesseract==0.3.13
openai-whisper==20240930
pydub==0.25.1
langcodes==3.5.0
langdetect==1.0.9
Update 1
Removed the unused api keys, now I am getting TypeError: argument of type 'bool' is not iterable
.
Update 2
1 Like
Try update gradio or fix pydantic version:
#gradio==5.6.0
or
gradio==5.6.0
pydantic==2.10.6
1 Like
It worked. Really appreciate it. Damn, I shouldn’t have missed your previous comment where you already added the pydantic
fix.
1 Like