Emuixom commited on
Commit
856d031
verified
1 Parent(s): dc181c8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -2
README.md CHANGED
@@ -12,20 +12,83 @@ widget:
12
  url: images/fadfea894bb82a4b3385f13f782c39f5.jpg
13
  base_model: black-forest-labs/FLUX.1-dev
14
  instance_prompt: trasher
15
-
16
  ---
 
17
  # Trasher
18
 
19
  <Gallery />
20
 
21
-
22
  ## Trigger words
23
 
24
  You should use `trasher` to trigger the image generation.
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ## Download model
28
 
29
  Weights for this model are available in Safetensors format.
30
 
31
  [Download](/Emuixom/Trasher_Riddick/tree/main) them in the Files & versions tab.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  url: images/fadfea894bb82a4b3385f13f782c39f5.jpg
13
  base_model: black-forest-labs/FLUX.1-dev
14
  instance_prompt: trasher
 
15
  ---
16
+
17
  # Trasher
18
 
19
  <Gallery />
20
 
 
21
  ## Trigger words
22
 
23
  You should use `trasher` to trigger the image generation.
24
 
25
+ ## Imagen generada
26
+
27
+ <div id="image-container">
28
+ <img id="generated-image"
29
+ src="https://huggingface.co/Emuixom/Trasher_Riddick/resolve/main/images/fadfea894bb82a4b3385f13f782c39f5.jpg"
30
+ alt="Generated Image"
31
+ oncontextmenu="showContextMenu(event)" />
32
+ </div>
33
+
34
+ <div id="context-menu" style="display: none; position: absolute; background-color: #fff; border: 1px solid #ccc; z-index: 1000;">
35
+ <ul style="list-style: none; margin: 0; padding: 0;">
36
+ <li onclick="copyImage()">Copiar Imagen</li>
37
+ <li onclick="downloadImage()">Descargar Imagen</li>
38
+ </ul>
39
+ </div>
40
 
41
  ## Download model
42
 
43
  Weights for this model are available in Safetensors format.
44
 
45
  [Download](/Emuixom/Trasher_Riddick/tree/main) them in the Files & versions tab.
46
+
47
+ <script>
48
+ // Mostrar men煤 contextual
49
+ function showContextMenu(event) {
50
+ event.preventDefault();
51
+ const menu = document.getElementById('context-menu');
52
+ menu.style.display = 'block';
53
+ menu.style.left = `${event.pageX}px`;
54
+ menu.style.top = `${event.pageY}px`;
55
+ }
56
+
57
+ // Ocultar men煤 al hacer clic fuera
58
+ document.addEventListener('click', () => {
59
+ const menu = document.getElementById('context-menu');
60
+ menu.style.display = 'none';
61
+ });
62
+
63
+ // Funci贸n para copiar imagen
64
+ async function copyImage() {
65
+ const imgElement = document.getElementById('generated-image');
66
+ try {
67
+ const blob = await fetch(imgElement.src).then(res => res.blob());
68
+ const clipboardItem = new ClipboardItem({ "image/png": blob });
69
+ await navigator.clipboard.write([clipboardItem]);
70
+ alert('Imagen copiada al portapapeles');
71
+ } catch (error) {
72
+ console.error('Error al copiar la imagen:', error);
73
+ alert('Error al copiar la imagen');
74
+ }
75
+ }
76
+
77
+ // Funci贸n para descargar imagen
78
+ function downloadImage() {
79
+ const imgElement = document.getElementById('generated-image');
80
+ fetch(imgElement.src)
81
+ .then(response => response.blob())
82
+ .then(blob => {
83
+ const url = URL.createObjectURL(blob);
84
+ const a = document.createElement('a');
85
+ a.style.display = 'none';
86
+ a.href = url;
87
+ a.download = 'generated_image.png';
88
+ document.body.appendChild(a);
89
+ a.click();
90
+ URL.revokeObjectURL(url);
91
+ })
92
+ .catch(error => console.error('Error al descargar la imagen:', error));
93
+ }
94
+ </script>