Hadiil commited on
Commit
fd94982
·
verified ·
1 Parent(s): 5ca4821

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -40,12 +40,6 @@ app = FastAPI(
40
  # Mount static files
41
  app.mount("/static", StaticFiles(directory="static"), name="static")
42
 
43
- # Mount videos directory
44
- app.mount("/videos", StaticFiles(directory="videos"), name="videos")
45
-
46
- # Mount videos directory
47
- app.mount("/images", StaticFiles(directory="images"), name="images")
48
-
49
  # Gemini API Configuration
50
  API_KEY = "AIzaSyCwmgD8KxzWiuivtySNtcZF_rfTvx9s9sY" # Replace with your actual API key
51
  genai.configure(api_key=API_KEY)
@@ -190,14 +184,14 @@ def detect_intent(text: str = None, file: UploadFile = None) -> tuple[str, str]:
190
  content_type = file.content_type.lower() if file.content_type else ""
191
  filename = file.filename.lower() if file.filename else ""
192
 
193
- # Added: Catch "what’s this" and "does this fly" first for images
194
  if content_type.startswith('image/') and text:
195
  text_lower = text.lower()
196
  if "what’s this" in text_lower:
197
  return "visual-qa", target_language
198
  if "does this fly" in text_lower:
199
  return "visual-qa", target_language
200
- # Added: Broaden "fly" questions for VQA
201
  if "fly" in text_lower and any(q in text_lower for q in ['does', 'can', 'will']):
202
  return "visual-qa", target_language
203
 
@@ -619,7 +613,7 @@ plt.show()"""
619
  @app.get("/", include_in_schema=False)
620
  async def home():
621
  """Redirect to the static index.html file"""
622
- return RedirectResponse(url="/static/tito.html")
623
 
624
  @app.get("/health", include_in_schema=True)
625
  async def health_check():
 
40
  # Mount static files
41
  app.mount("/static", StaticFiles(directory="static"), name="static")
42
 
 
 
 
 
 
 
43
  # Gemini API Configuration
44
  API_KEY = "AIzaSyCwmgD8KxzWiuivtySNtcZF_rfTvx9s9sY" # Replace with your actual API key
45
  genai.configure(api_key=API_KEY)
 
184
  content_type = file.content_type.lower() if file.content_type else ""
185
  filename = file.filename.lower() if file.filename else ""
186
 
187
+ # Catch "what’s this" and "does this fly" first for images
188
  if content_type.startswith('image/') and text:
189
  text_lower = text.lower()
190
  if "what’s this" in text_lower:
191
  return "visual-qa", target_language
192
  if "does this fly" in text_lower:
193
  return "visual-qa", target_language
194
+ # Broaden "fly" questions for VQA
195
  if "fly" in text_lower and any(q in text_lower for q in ['does', 'can', 'will']):
196
  return "visual-qa", target_language
197
 
 
613
  @app.get("/", include_in_schema=False)
614
  async def home():
615
  """Redirect to the static index.html file"""
616
+ return RedirectResponse(url="/static/index.html")
617
 
618
  @app.get("/health", include_in_schema=True)
619
  async def health_check():