|
24 | 24 | Script, |
25 | 25 | StreamingResponse, |
26 | 26 | fast_app, |
27 | | - serve, |
28 | 27 | ) |
29 | 28 | from PIL import Image |
30 | 29 | from shad4fast import ShadHead |
|
43 | 42 | SimMapButtonReady, |
44 | 43 | ) |
45 | 44 | from frontend.layout import Layout |
| 45 | +import uvicorn |
46 | 46 |
|
47 | 47 | highlight_js_theme_link = Link(id="highlight-theme", rel="stylesheet", href="") |
48 | 48 | highlight_js_theme = Script(src="/static/js/highlightjs-theme.js") |
|
68 | 68 | awesomplete_js = Script( |
69 | 69 | src="https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.7/awesomplete.min.js" |
70 | 70 | ) |
71 | | -sselink = Script( src="https://unpkg.com/[email protected]/sse.js") |
| 71 | +sselink = Script( |
| 72 | + src="https://cdn.jsdelivr.net/npm/[email protected]", |
| 73 | + integrity="sha384-A986SAtodyH8eg8x8irJnYUk7i9inVQqYigD6qZ9evobksGNIXfeFvDwLSHcp31N", |
| 74 | + crossorigin="anonymous", |
| 75 | +) |
72 | 76 |
|
73 | 77 | # Get log level from environment variable, default to INFO |
74 | 78 | LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper() |
|
112 | 116 | Do NOT include backticks (`) in your response. Only simple HTML tags and text. |
113 | 117 | """ |
114 | 118 | gemini_model = genai.GenerativeModel( |
115 | | - "gemini-2.0-flash", system_instruction=GEMINI_SYSTEM_PROMPT |
| 119 | + "gemini-2.5-flash", system_instruction=GEMINI_SYSTEM_PROMPT |
116 | 120 | ) |
117 | 121 | STATIC_DIR = Path("static") |
118 | 122 | IMG_DIR = STATIC_DIR / "full_images" |
@@ -381,7 +385,7 @@ async def message_generator(query_id: str, query: str, doc_ids: list): |
381 | 385 | # yield message with number of images ready |
382 | 386 | yield f"event: message\ndata: Generating response based on {len(images)} images...\n\n" |
383 | 387 | if not images: |
384 | | - yield "event: message\ndata: Failed to send images to Gemini 2.0!\n\n" |
| 388 | + yield "event: message\ndata: Failed to send images to Gemini 2.5!\n\n" |
385 | 389 | yield "event: close\ndata: \n\n" |
386 | 390 | return |
387 | 391 |
|
@@ -417,4 +421,5 @@ def get(): |
417 | 421 | if __name__ == "__main__": |
418 | 422 | HOT_RELOAD = os.getenv("HOT_RELOAD", "False").lower() == "true" |
419 | 423 | logger.info(f"Starting app with hot reload: {HOT_RELOAD}") |
420 | | - serve(port=7860, reload=HOT_RELOAD) |
| 424 | + uvicorn.run("main:app", host="0.0.0.0", timeout_worker_healthcheck=30, port=7860) |
| 425 | + # serve(port=7860, reload=HOT_RELOAD) |
0 commit comments