TheShellMaster commited on
Commit
d256fee
·
verified ·
1 Parent(s): c34f23a

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. app.py +0 -7
  2. index.html +5 -31
  3. requirements.txt +1 -1
app.py CHANGED
@@ -78,13 +78,7 @@ async def user_profile(request: Request):
78
  email = request.headers.get("x-hf-user-email") or ""
79
  return {"username": username, "avatar": avatar, "email": email}
80
 
81
- @app.get("/login/huggingface")
82
- async def login_hf():
83
- return RedirectResponse(url="/gradio/login/huggingface")
84
 
85
- @app.get("/logout")
86
- async def logout_hf():
87
- return RedirectResponse(url="/gradio/logout")
88
 
89
  @app.post("/api/chat")
90
  async def chat(request: Request):
@@ -540,7 +534,6 @@ footer {visibility: hidden}
540
  """
541
 
542
  with gr.Blocks(theme=theme, css=css) as demo:
543
- gr.LoginButton(visible=False)
544
  gr.HTML("""
545
  <div class="title-container">
546
  <h1>💻 Cypher Coder</h1>
 
78
  email = request.headers.get("x-hf-user-email") or ""
79
  return {"username": username, "avatar": avatar, "email": email}
80
 
 
 
 
81
 
 
 
 
82
 
83
  @app.post("/api/chat")
84
  async def chat(request: Request):
 
534
  """
535
 
536
  with gr.Blocks(theme=theme, css=css) as demo:
 
537
  gr.HTML("""
538
  <div class="title-container">
539
  <h1>💻 Cypher Coder</h1>
index.html CHANGED
@@ -331,24 +331,7 @@
331
  </head>
332
  <body>
333
 
334
- <!-- AUTHENTICATION LAYER -->
335
- <div id="auth-layer" class="login-container" style="display: none;">
336
- <div class="ansi-banner">
337
- _____ _---------------+
338
- / ____| | | ____ _ |
339
- | | _ _ _ __ | |__| _ \| | | CYPHER CODER CLI
340
- | | | | | | '_ \ | __ |_) | | | L'IA experte en développement local
341
- | |___| |_| | |_) || | | __/| |___ | Créé par DJAKOUA KWANKAM
342
- \_____\__, | .__/ |_| |_| |_____|| Institut Universitaire de Technologie de Douala (IUT)
343
- __/ | | |
344
- |___/|_| +-----------------------+
345
- </div>
346
- <div class="login-box">
347
- <div class="login-title">🔐 AUTHENTIFICATION REQUISE</div>
348
- <div class="login-desc">Veuillez vous connecter avec votre compte Hugging Face pour accéder au terminal de Cypher Coder.</div>
349
- <button class="login-btn" onclick="redirectToLogin()">SE CONNECTER AVEC HUGGING FACE</button>
350
- </div>
351
- </div>
352
 
353
  <!-- MAIN APP LAYER -->
354
  <div id="app-layer" style="display: flex; flex-direction: column; height: 100vh; width: 100%;">
@@ -364,9 +347,6 @@
364
  <span class="header-separator">|</span>
365
  <span id="header-tokens" class="header-meta">tokens : 0</span>
366
  </div>
367
- <div>
368
- <a href="/logout" style="color: #FF5555; text-decoration: none; font-size: 12px;">[Déconnexion]</a>
369
- </div>
370
  </header>
371
 
372
  <!-- ZONE DE CHAT -->
@@ -442,26 +422,20 @@ Tape /help pour voir les commandes disponibles.</div>
442
  try {
443
  const res = await fetch("/api/user-profile");
444
  const data = await res.json();
445
- if (data.username && data.username !== "invité") {
446
  currentUser = data.username;
447
- document.getElementById("auth-layer").style.display = "none";
448
- document.getElementById("app-layer").style.display = "flex";
449
- } else {
450
- document.getElementById("auth-layer").style.display = "flex";
451
- document.getElementById("app-layer").style.display = "none";
452
  }
453
  headerUsername.innerText = "@" + currentUser;
454
  bannerUsername.innerText = "@" + currentUser;
455
  bannerSession.innerText = sessionId;
456
  } catch (e) {
457
  console.error("Auth fetch error:", e);
 
 
 
458
  }
459
  }
460
 
461
- function redirectToLogin() {
462
- window.location.href = "/login/huggingface";
463
- }
464
-
465
  fetchUserInfo();
466
 
467
  // Autocomplete rendering
 
331
  </head>
332
  <body>
333
 
334
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
 
336
  <!-- MAIN APP LAYER -->
337
  <div id="app-layer" style="display: flex; flex-direction: column; height: 100vh; width: 100%;">
 
347
  <span class="header-separator">|</span>
348
  <span id="header-tokens" class="header-meta">tokens : 0</span>
349
  </div>
 
 
 
350
  </header>
351
 
352
  <!-- ZONE DE CHAT -->
 
422
  try {
423
  const res = await fetch("/api/user-profile");
424
  const data = await res.json();
425
+ if (data.username) {
426
  currentUser = data.username;
 
 
 
 
 
427
  }
428
  headerUsername.innerText = "@" + currentUser;
429
  bannerUsername.innerText = "@" + currentUser;
430
  bannerSession.innerText = sessionId;
431
  } catch (e) {
432
  console.error("Auth fetch error:", e);
433
+ headerUsername.innerText = "@" + currentUser;
434
+ bannerUsername.innerText = "@" + currentUser;
435
+ bannerSession.innerText = sessionId;
436
  }
437
  }
438
 
 
 
 
 
439
  fetchUserInfo();
440
 
441
  // Autocomplete rendering
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  fastapi
2
  uvicorn
3
- gradio[oauth]
4
  huggingface_hub
5
  duckduckgo-search
 
1
  fastapi
2
  uvicorn
3
+ gradio
4
  huggingface_hub
5
  duckduckgo-search