Upload folder using huggingface_hub
Browse files- app.py +43 -9
- jsnslv/jsnslv.go +12 -0
app.py
CHANGED
@@ -59,22 +59,56 @@ def complete(data):
|
|
59 |
f.close()
|
60 |
break
|
61 |
return json.dumps({"status": "ok"})
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
with gr.Blocks() as bl:
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
with gr.Row("panel"):
|
65 |
gr.Label("Enter a prompt to generate an image. This is a work-in-progress. Release 1.")
|
66 |
with gr.Row("panel"):
|
67 |
-
prompt_input = gr.Textbox(placeholder="Enter a prompt here")
|
68 |
with gr.Row("panel"):
|
69 |
-
submit_button = gr.Button(value="Generate")
|
70 |
with gr.Row("panel"):
|
71 |
image_output = gr.Image(label="Generated Image")
|
72 |
-
with gr.Row("none"):
|
73 |
-
shad_out = gr.Textbox(visible=False)
|
74 |
-
shad_dequeue = gr.Button(value="Dequeue", visible=False)
|
75 |
-
shad_in = gr.Textbox(visible=False)
|
76 |
-
shad_complete = gr.Button(value="Complete", visible=False)
|
77 |
submit_button.click(enqueue, inputs=[prompt_input], api_name="enqueue")
|
78 |
shad_dequeue.click(dequeue, outputs=[shad_out], api_name="dequeue")
|
79 |
shad_complete.click(complete, inputs=[shad_in], outputs=[shad_out], api_name="complete")
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
f.close()
|
60 |
break
|
61 |
return json.dumps({"status": "ok"})
|
62 |
+
|
63 |
+
class ValueClass():
|
64 |
+
def __init__(self, value):
|
65 |
+
self.value = value
|
66 |
+
|
67 |
+
def worker():
|
68 |
+
while True:
|
69 |
+
if not q.empty():
|
70 |
+
pr = json.loads(q.get_nowait())
|
71 |
+
pr["status"] = "progress"
|
72 |
+
for w in WORKERS:
|
73 |
+
if w["status"] == "idle":
|
74 |
+
w["status"] = "busy"
|
75 |
+
w["prompt"] = pr["prompt"]
|
76 |
+
w["id"] = pr["id"]
|
77 |
+
break
|
78 |
+
else:
|
79 |
+
q.put(json.dumps(pr))
|
80 |
+
time.sleep(1)
|
81 |
+
|
82 |
with gr.Blocks() as bl:
|
83 |
+
with gr.Row("none"):
|
84 |
+
shad_out = gr.Textbox(visible=False)
|
85 |
+
shad_dequeue = gr.Button(value="Dequeue", visible=False)
|
86 |
+
shad_in = gr.Textbox(visible=False)
|
87 |
+
shad_complete = gr.Button(value="Complete", visible=False)
|
88 |
+
shad_submitted = gr.Checkbox(visible=False)
|
89 |
with gr.Row("panel"):
|
90 |
gr.Label("Enter a prompt to generate an image. This is a work-in-progress. Release 1.")
|
91 |
with gr.Row("panel"):
|
92 |
+
prompt_input = gr.Textbox(placeholder="Enter a prompt here", visible=shad_complete.value)
|
93 |
with gr.Row("panel"):
|
94 |
+
submit_button = gr.Button(value="Generate", visible=True)
|
95 |
with gr.Row("panel"):
|
96 |
image_output = gr.Image(label="Generated Image")
|
|
|
|
|
|
|
|
|
|
|
97 |
submit_button.click(enqueue, inputs=[prompt_input], api_name="enqueue")
|
98 |
shad_dequeue.click(dequeue, outputs=[shad_out], api_name="dequeue")
|
99 |
shad_complete.click(complete, inputs=[shad_in], outputs=[shad_out], api_name="complete")
|
100 |
+
|
101 |
+
def kill_the_noise_skrillex(btn):
|
102 |
+
prompt_input.visible = False
|
103 |
+
prompt_input.value = ""
|
104 |
+
submit_button.visible = False
|
105 |
+
return btn
|
106 |
+
|
107 |
+
prompt_input = gr.Textbox(label="Prompt")
|
108 |
+
submit_button = gr.Button("Submit")
|
109 |
+
|
110 |
+
demo = gr.Interface(fn=kill_the_noise_skrillex,
|
111 |
+
inputs=[submit_button],
|
112 |
+
outputs=[submit_button])
|
113 |
+
|
114 |
+
demo.launch()
|
jsnslv/jsnslv.go
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
package jsnslvp
|
2 |
+
|
3 |
+
import (
|
4 |
+
"fmt"
|
5 |
+
"net/http"
|
6 |
+
"github.com/gin/gionic"
|
7 |
+
)
|
8 |
+
|
9 |
+
int main() {
|
10 |
+
fmt.Println("Hello, golang!!!")
|
11 |
+
return 0
|
12 |
+
}
|