Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

2.1 KB
Raw Blame
/**
 * When running Langfuse in HuggingFace Spaces, the app needs to be opened in a new tab.
 * Otherwise, the app will not be able to access the session cookie.
 */

import { Button } from "@/src/components/ui/button";
import { LangfuseIcon } from "@/src/components/design-system/LangfuseIcon/LangfuseIcon";
import Head from "next/head";
import Link from "next/link";
import { PlusIcon } from "@langfuse/icons";
import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";

export type PageProps = {
  deploymentDomain: string;
};

export default function HfSpacesPage({ deploymentDomain }: PageProps) {
  return (
    <>
      <Head>
        <title>Langfuse on Hugging Face</title>
      </Head>
      <div className="flex flex-1 flex-col py-6 sm:min-h-full sm:justify-center sm:px-6 sm:py-12 lg:px-8">
        <div className="sm:mx-auto sm:w-full sm:max-w-md">
          <div className="flex items-center justify-center gap-2">
            <LangfuseIcon />
            <PlusIcon size="sm" __rawClassName="ml-1" />
            {/* eslint-disable-next-line @next/next/no-img-element */}
            <img
              src="/assets/huggingface-logo.svg"
              alt="Hugging Face Logo"
              width={36}
              height={36}
            />
          </div>
          <h2 className="text-primary mt-4 text-center text-2xl leading-9 font-bold tracking-tight">
            Langfuse on Hugging Face
          </h2>
        </div>

        <div className="bg-card mt-14 rounded-lg px-6 py-10 shadow-sm sm:mx-auto sm:w-full sm:max-w-[480px] sm:px-10">
          <div className="space-y-8">
            <CodeSection
              title="HF Space Host"
              variant="outline"
              content={deploymentDomain}
            />

            <Button className="w-full" asChild>
              <Link
                href={deploymentDomain}
                target="_blank"
                rel="noopener noreferrer"
              >
                Open in new tab
              </Link>
            </Button>
          </div>
        </div>
      </div>
    </>
  );
}