Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -235,7 +235,6 @@
|
|
235 |
# # http://localhost:8000/docs#/
|
236 |
# # (.venv) PS C:\Users\antoi\Documents\Work_Learn\Labeling-Deploy\FastAPI> uvicorn main:app --host 0.0.0.0 --port 8000 --workers 1
|
237 |
|
238 |
-
|
239 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
240 |
import cv2
|
241 |
import torch
|
@@ -268,8 +267,7 @@ app.add_middleware(
|
|
268 |
CORSMiddleware,
|
269 |
allow_origins=[
|
270 |
"http://localhost:8080",
|
271 |
-
"https://
|
272 |
-
"https://my-vue-app-latest-qqzd.onrender.com/",
|
273 |
],
|
274 |
allow_credentials=True,
|
275 |
allow_methods=["*"], # Permet toutes les méthodes HTTP (GET, POST, etc.)
|
@@ -486,7 +484,7 @@ def upload_to_hf_dataset(user_name: str, video_path: str):
|
|
486 |
|
487 |
try:
|
488 |
hf_api.upload_file(
|
489 |
-
path_or_fileobj=video_path,
|
490 |
path_in_repo=repo_path,
|
491 |
repo_id=dataset_name,
|
492 |
repo_type="dataset",
|
@@ -517,33 +515,6 @@ async def index():
|
|
517 |
"""
|
518 |
)
|
519 |
|
520 |
-
import logging
|
521 |
-
|
522 |
-
logging.basicConfig(level=logging.INFO)
|
523 |
-
logger = logging.getLogger(__name__)
|
524 |
-
|
525 |
-
@app.post("/test_connection/")
|
526 |
-
async def test_connection(user_name: str):
|
527 |
-
try:
|
528 |
-
# Log for debugging purposes
|
529 |
-
logger.info(f"Received user_name: {user_name}")
|
530 |
-
print(f"Received user_name: {user_name}")
|
531 |
-
|
532 |
-
# Simple response for testing purposes
|
533 |
-
response_message = f"Hello, {user_name}! The backend is reachable and working correctly."
|
534 |
-
|
535 |
-
# Log the response message
|
536 |
-
logger.info(f"Returning response: {response_message}")
|
537 |
-
print(f"Returning response: {response_message}")
|
538 |
-
|
539 |
-
return {
|
540 |
-
"message": response_message
|
541 |
-
}
|
542 |
-
|
543 |
-
except Exception as e:
|
544 |
-
logger.error(f"Error during test connection: {str(e)}")
|
545 |
-
print(f"Error during test connection: {str(e)}")
|
546 |
-
raise HTTPException(status_code=500, detail=f"Failed to connect: {str(e)}")
|
547 |
|
548 |
|
549 |
# Lancer l'application avec uvicorn (command line)
|
|
|
235 |
# # http://localhost:8000/docs#/
|
236 |
# # (.venv) PS C:\Users\antoi\Documents\Work_Learn\Labeling-Deploy\FastAPI> uvicorn main:app --host 0.0.0.0 --port 8000 --workers 1
|
237 |
|
|
|
238 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
239 |
import cv2
|
240 |
import torch
|
|
|
267 |
CORSMiddleware,
|
268 |
allow_origins=[
|
269 |
"http://localhost:8080",
|
270 |
+
"https://labeling-tools.onrender.com/",
|
|
|
271 |
],
|
272 |
allow_credentials=True,
|
273 |
allow_methods=["*"], # Permet toutes les méthodes HTTP (GET, POST, etc.)
|
|
|
484 |
|
485 |
try:
|
486 |
hf_api.upload_file(
|
487 |
+
path_or_fileobj=video_path, #chelou
|
488 |
path_in_repo=repo_path,
|
489 |
repo_id=dataset_name,
|
490 |
repo_type="dataset",
|
|
|
515 |
"""
|
516 |
)
|
517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
|
520 |
# Lancer l'application avec uvicorn (command line)
|