Spaces:
Running

File size: 1,559 Bytes
e1982cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7eceb3
e1982cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b6b8189
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="pt-br">
<head>
  <meta charset="UTF-8" />
  <title>Teste DeepSeek API</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      padding: 2rem;
      max-width: 800px;
      margin: auto;
    }
    textarea, button {
      width: 100%;
      margin-top: 1rem;
      padding: 0.75rem;
      font-size: 1rem;
    }
    #output {
      white-space: pre-wrap;
      margin-top: 1rem;
      background: #f0f0f0;
      padding: 1rem;
      border-radius: 6px;
      min-height: 80px;
    }
  </style>
</head>
<body>
  <h1>Jarvis DeepSeek - via API</h1>
  <textarea id="prompt" rows="4" placeholder="Digite sua pergunta aqui...">Explique o que é uma API REST.</textarea>
  <button onclick="enviarPrompt()">Enviar</button>
  <div id="output"></div>

  <script>
    async function enviarPrompt() {
      const prompt = document.getElementById("prompt").value;
      const output = document.getElementById("output");
      output.textContent = "Consultando modelo...";

      try {
        const response = await fetch("https://maicoul-api-proxy.hf.space/", {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({
            prompt: prompt,
            n_predict: 100,
            temperature: 0.7
          })
        });

        const data = await response.json();
        output.textContent = data.content || JSON.stringify(data, null, 2);
      } catch (err) {
        output.textContent = "Erro: " + err.message;
      }
    }
  </script>
</body>
</html>