Spaces:
Runtime error
Runtime error
RoniFinTech
commited on
Commit
·
0536019
1
Parent(s):
bba8925
cache-fix
Browse files- cache/local_cache.py +1 -1
- main.py +6 -0
cache/local_cache.py
CHANGED
@@ -32,7 +32,7 @@ def ttl_cache(key_name, media_type=None, ttl_secs=20):
|
|
32 |
# Call the actual function if not in cache or expired
|
33 |
response: StreamingResponse = await func(*args, **kwargs)
|
34 |
# Cache the content of the response's body.
|
35 |
-
content =
|
36 |
_cache[key] = content
|
37 |
_cache_time[key] = datetime.now()
|
38 |
|
|
|
32 |
# Call the actual function if not in cache or expired
|
33 |
response: StreamingResponse = await func(*args, **kwargs)
|
34 |
# Cache the content of the response's body.
|
35 |
+
content = response.body
|
36 |
_cache[key] = content
|
37 |
_cache_time[key] = datetime.now()
|
38 |
|
main.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
from huggingface_hub import login
|
@@ -30,3 +31,8 @@ async def root():
|
|
30 |
|
31 |
|
32 |
app.include_router(stable_diffusion.router, prefix=settings.prefix, tags=["inference"])
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import uvicorn
|
2 |
from fastapi import FastAPI
|
3 |
from fastapi.middleware.cors import CORSMiddleware
|
4 |
from huggingface_hub import login
|
|
|
31 |
|
32 |
|
33 |
app.include_router(stable_diffusion.router, prefix=settings.prefix, tags=["inference"])
|
34 |
+
|
35 |
+
# Start your FastAPI application
|
36 |
+
# if __name__ == "__main__":
|
37 |
+
# uvicorn.run(app, host="0.0.0.0", port=8000)
|
38 |
+
#
|