Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -171,6 +171,13 @@ if __name__ == "__main__":
|
|
171 |
# exit(1) # Uncomment to exit if API key is missing
|
172 |
|
173 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
demo.launch(show_api=False, share=True) # share=True for HF Spaces public link
|
175 |
except NameError as ne:
|
176 |
print(f"Gradio demo could not be launched. 'client' might not have been initialized: {ne}")
|
|
|
171 |
# exit(1) # Uncomment to exit if API key is missing
|
172 |
|
173 |
try:
|
174 |
+
# Enable Gradio's queuing system to manage concurrent requests.
|
175 |
+
# This helps avoid hitting API rate limits from services like Featherless AI.
|
176 |
+
# You can optionally set a default_concurrency_limit if you know your Featherless AI plan's limit.
|
177 |
+
# For example, if your plan allows 5 concurrent requests: demo.queue(default_concurrency_limit=5)
|
178 |
+
# If you're unsure, starting with the default (often 1) is safer to avoid 429s.
|
179 |
+
demo.queue()
|
180 |
+
|
181 |
demo.launch(show_api=False, share=True) # share=True for HF Spaces public link
|
182 |
except NameError as ne:
|
183 |
print(f"Gradio demo could not be launched. 'client' might not have been initialized: {ne}")
|