Env implementation
This commit is contained in:
@@ -145,7 +145,11 @@ app = FastAPI(title="YOLOPOTHOLE API", version="1.0.0")
|
|||||||
# CORS configuration
|
# CORS configuration
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["http://localhost:3000"], # Frontend URL
|
allow_origins=[
|
||||||
|
"http://localhost:3000",
|
||||||
|
"https://karlene-unprovoked-lithely.ngrok-free.dev/api/v1",
|
||||||
|
"https://secret-pharmaceutical-murphy-traffic.trycloudflare.com"
|
||||||
|
],
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
type Project
|
type Project
|
||||||
} from "@/lib/api"
|
} from "@/lib/api"
|
||||||
|
|
||||||
const API_URL = "http://127.0.0.1:8000/api/v1"
|
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
interface ProjectSummary {
|
interface ProjectSummary {
|
||||||
project: {
|
project: {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
import { getVideoFile, clearVideoFile } from "@/lib/video-storage"
|
import { getVideoFile, clearVideoFile } from "@/lib/video-storage"
|
||||||
import { DetectionData, DetectionType } from "@/lib/types"
|
import { DetectionData, DetectionType } from "@/lib/types"
|
||||||
|
|
||||||
const API_URL = "http://127.0.0.1:8000/api/v1"
|
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
export default function ResultsPage() {
|
export default function ResultsPage() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import {
|
|||||||
} from "@/lib/api"
|
} from "@/lib/api"
|
||||||
import { storeVideoFile } from "@/lib/video-storage"
|
import { storeVideoFile } from "@/lib/video-storage"
|
||||||
|
|
||||||
const API_URL = "http://127.0.0.1:8000/api/v1"
|
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||||
const WS_URL = "ws://127.0.0.1:8000/api/v1"
|
const WS_URL = API_URL?.replace(/^https?:\/\//, "wss://")
|
||||||
|
|
||||||
type DetectionType = "pothole-detection" | "sign-board-detection" | "pot-sign-detection"
|
type DetectionType = "pothole-detection" | "sign-board-detection" | "pot-sign-detection"
|
||||||
|
|
||||||
|
|||||||
@@ -90,10 +90,10 @@ export function RecentAnalysesTable({ videos, isLoading, onViewResults }: Recent
|
|||||||
<div className="text-right flex-shrink-0 w-20">
|
<div className="text-right flex-shrink-0 w-20">
|
||||||
<p className="text-sm font-bold text-foreground">
|
<p className="text-sm font-bold text-foreground">
|
||||||
{video.detection_type === "pothole-detection"
|
{video.detection_type === "pothole-detection"
|
||||||
? video.unique_potholes ?? 0
|
? video.unique_pothole ?? 0
|
||||||
: video.detection_type === "pot-sign-detection"
|
: video.detection_type === "pot-sign-detection"
|
||||||
? (video.unique_potholes ?? 0) + (video.unique_signboards ?? 0)
|
? (video.unique_pothole ?? 0) + (video.unique_defected_sign_board ?? 0) + (video.unique_good_sign_board ?? 0)
|
||||||
: video.unique_signboards ?? 0}
|
: (video.unique_defected_sign_board ?? 0) + (video.unique_good_sign_board ?? 0)}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-[10px] text-muted-foreground uppercase">Detections</p>
|
<p className="text-[10px] text-muted-foreground uppercase">Detections</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
|
|||||||
import { Upload, Loader2, AlertCircle } from "lucide-react"
|
import { Upload, Loader2, AlertCircle } from "lucide-react"
|
||||||
import type { DetectionData, DetectionType } from "@/lib/types"
|
import type { DetectionData, DetectionType } from "@/lib/types"
|
||||||
|
|
||||||
const API_URL = "http://127.0.0.1:8000/api/v1"
|
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||||
const WS_URL = "ws://127.0.0.1:8000/api/v1"
|
const WS_URL = API_URL?.replace(/^https?:\/\//, "wss://")
|
||||||
|
|
||||||
|
|
||||||
type UploadSectionProps = {
|
type UploadSectionProps = {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const MapModal = dynamic(() => import("@/components/map-modal"), { ssr: false })
|
|||||||
|
|
||||||
import { DetectionData, DetectionType } from "@/lib/types"
|
import { DetectionData, DetectionType } from "@/lib/types"
|
||||||
|
|
||||||
const API_URL = "http://127.0.0.1:8000/api/v1"
|
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Provides typed functions for interacting with the backend API
|
* Provides typed functions for interacting with the backend API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const API_URL = "http://127.0.0.1:8000/api/v1"
|
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
// Type definitions
|
// Type definitions
|
||||||
export interface Project {
|
export interface Project {
|
||||||
|
|||||||
3258
pnpm-lock.yaml
generated
3258
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user