awacke1 commited on
Commit
6c17c87
β€’
1 Parent(s): a52d48d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -37
app.py CHANGED
@@ -21,47 +21,14 @@ import huggingface_hub
21
  from huggingface_hub import Repository
22
  from datetime import datetime
23
 
24
- DATASET_REPO_URL = "https://huggingface.co/datasets/awacke1/BookComposer"
25
- DATA_FILENAME = "BookComposer.csv"
26
- DATA_FILE = os.path.join("data", DATA_FILENAME)
27
-
28
  HF_TOKEN = os.environ.get("HF_TOKEN")
29
  print("is none?", HF_TOKEN is None)
30
-
31
- print("hfh", huggingface_hub.__version__)
32
-
33
- # overriding/appending to the gradio template
34
- SCRIPT = """
35
- <script>
36
- if (!window.hasBeenRun) {
37
- window.hasBeenRun = true;
38
- console.log("should only happen once");
39
- document.querySelector("button.submit").click();
40
- }
41
- </script>
42
- """
43
-
44
- #with open(os.path.join(gr.networking.STATIC_TEMPLATE_LIB, "frontend", "index.html"), "a") as f:
45
- # f.write(SCRIPT)
46
-
47
- # -------------------------------------------- For Memory - you will need to set up a dataset and HF_TOKEN ---------
48
- UseMemory=True
49
-
50
-
51
  DATASET_REPO_URL = "https://huggingface.co/datasets/awacke1/BookComposer"
52
  DATA_FILENAME = "BookComposer.csv"
53
  DATA_FILE=os.path.join("data", DATA_FILENAME)
54
  HF_TOKEN=os.environ.get("HF_TOKEN")
55
- repo = Repository(
56
- local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
57
- )
58
-
59
-
60
-
61
-
62
 
63
  def gan():
64
-
65
  images = [
66
  (random.choice(
67
  [
@@ -106,13 +73,55 @@ def gan():
106
  ]
107
  return images
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  with gr.Blocks() as demo:
111
  with gr.Column(variant="panel"):
112
- [
113
- inputs.Textbox(placeholder="Your name"),
114
- inputs.Textbox(placeholder="Your message", lines=2),
115
- ]
116
  with gr.Row(variant="compact"):
117
  text = gr.Textbox(
118
  label="Health and Medical Icon Sets",
@@ -130,6 +139,7 @@ with gr.Blocks() as demo:
130
  ).style(grid=[2], height="auto")
131
 
132
  btn.click(gan, None, gallery)
 
133
 
134
  if __name__ == "__main__":
135
  demo.launch()
 
21
  from huggingface_hub import Repository
22
  from datetime import datetime
23
 
 
 
 
 
24
  HF_TOKEN = os.environ.get("HF_TOKEN")
25
  print("is none?", HF_TOKEN is None)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  DATASET_REPO_URL = "https://huggingface.co/datasets/awacke1/BookComposer"
27
  DATA_FILENAME = "BookComposer.csv"
28
  DATA_FILE=os.path.join("data", DATA_FILENAME)
29
  HF_TOKEN=os.environ.get("HF_TOKEN")
 
 
 
 
 
 
 
30
 
31
  def gan():
 
32
  images = [
33
  (random.choice(
34
  [
 
73
  ]
74
  return images
75
 
76
+ def gan2():
77
+ images = [
78
+ (random.choice(
79
+ [
80
+ "Comectress.png",
81
+ "Comic Plate 1 - Amnesia.png",
82
+ "Comic Plate 1 - Depths.png",
83
+ "Comic Plate 1 - Helion.png",
84
+ "Comic Plate 1 - Kitsune.png",
85
+ "Comic Plate 1 - Sinbad.png",
86
+ "Comic Plate 1 - Vampiress.png",
87
+ "Comic Plate 2 - Amnesia.png",
88
+ "Comic Plate 2 - Depths.png",
89
+ "Comic Plate 2 - Helion.png",
90
+ "Comic Plate 2 - Kitsune.png",
91
+ "Comic Plate 2 - Sinbad.png",
92
+ "Comic Plate 2 - Vampiress.png",
93
+ "Comic Plate 3 - Amnesia.png",
94
+ "Comic Plate 3 - Depths.png",
95
+ "Comic Plate 3 - Helion.png",
96
+ "Comic Plate 3 - Kitsune.png",
97
+ "Comic Plate 3 - Vampiress.png",
98
+ "Comic Plate 4 - Amnesia.png",
99
+ "Comic Plate 4 - Depths.png",
100
+ "Comic Plate 4 - Helion.png",
101
+ "Comic Plate 4 - Kitsune.png",
102
+ "Comic Plate 4 - Sinbad.png",
103
+ "Comic Plate 4 - Vampiress.png",
104
+ "Comic Plate 5 - Vampiress.png",
105
+ "Gold Suit.png",
106
+ "Heavens.png",
107
+ "Red Dot Sight.png",
108
+ "Starfire.png",
109
+ "Vamp 1.png",
110
+ "Vamp 2.png",
111
+ "Vamp 3.png",
112
+ "Vamp 4.png",
113
+ "Whirlwind.png",
114
+ "Zyphoria.png",
115
+ ]
116
+ ), f"label {i}" if i != 0 else "label" * 50)
117
+ for i in range(10)
118
+ ]
119
+ return images
120
+
121
+
122
 
123
  with gr.Blocks() as demo:
124
  with gr.Column(variant="panel"):
 
 
 
 
125
  with gr.Row(variant="compact"):
126
  text = gr.Textbox(
127
  label="Health and Medical Icon Sets",
 
139
  ).style(grid=[2], height="auto")
140
 
141
  btn.click(gan, None, gallery)
142
+ btn2.click(gan2, None, gallery)
143
 
144
  if __name__ == "__main__":
145
  demo.launch()