Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 2 |
-
|
| 3 |
import os, subprocess
|
| 4 |
import torch
|
| 5 |
|
|
@@ -113,36 +111,9 @@ article = """
|
|
| 113 |
css = '''
|
| 114 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
| 115 |
a {text-decoration-line: underline; font-weight: 600;}
|
| 116 |
-
.animate-spin {
|
| 117 |
-
animation: spin 1s linear infinite;
|
| 118 |
-
}
|
| 119 |
-
@keyframes spin {
|
| 120 |
-
from {
|
| 121 |
-
transform: rotate(0deg);
|
| 122 |
-
}
|
| 123 |
-
to {
|
| 124 |
-
transform: rotate(360deg);
|
| 125 |
-
}
|
| 126 |
-
}
|
| 127 |
-
#share-btn-container {
|
| 128 |
-
display: flex; padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; width: 15rem;
|
| 129 |
-
}
|
| 130 |
-
#share-btn {
|
| 131 |
-
all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.25rem !important; padding-bottom: 0.25rem !important;
|
| 132 |
-
}
|
| 133 |
-
#share-btn * {
|
| 134 |
-
all: unset;
|
| 135 |
-
}
|
| 136 |
-
#share-btn-container div:nth-child(-n+2){
|
| 137 |
-
width: auto !important;
|
| 138 |
-
min-height: 0px !important;
|
| 139 |
-
}
|
| 140 |
-
#share-btn-container .wrap {
|
| 141 |
-
display: none !important;
|
| 142 |
-
}
|
| 143 |
'''
|
| 144 |
|
| 145 |
-
with gr.Blocks(css=css) as
|
| 146 |
with gr.Column(elem_id="col-container"):
|
| 147 |
gr.HTML(title)
|
| 148 |
|
|
@@ -154,19 +125,12 @@ with gr.Blocks(css=css) as block:
|
|
| 154 |
submit_btn = gr.Button("Submit")
|
| 155 |
|
| 156 |
output_text = gr.Textbox(label="Description Output", elem_id="output-txt")
|
| 157 |
-
|
| 158 |
-
with gr.Group(elem_id="share-btn-container"):
|
| 159 |
-
community_icon = gr.HTML(community_icon_html, visible=True)
|
| 160 |
-
loading_icon = gr.HTML(loading_icon_html, visible=True)
|
| 161 |
-
share_button = gr.Button("Share with Community", elem_id="share-btn", visible=True)
|
| 162 |
|
| 163 |
examples=[['27E894C4-9375-48A1-A95D-CB2425416B4B.png', "best",4], ['DB362F56-BA98-4CA1-A999-A25AA94B723B.png',"fast",4]]
|
| 164 |
-
ex = gr.Examples(examples=examples, fn=inference, inputs=[input_image, mode_input, flavor_input], outputs=[output_text
|
| 165 |
-
ex.dataset.headers = [""]
|
| 166 |
|
| 167 |
gr.HTML(article)
|
| 168 |
|
| 169 |
-
submit_btn.click(fn=inference, inputs=[input_image,mode_input,flavor_input], outputs=[output_text
|
| 170 |
-
share_button.click(None, [], [], js=share_js)
|
| 171 |
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
| 1 |
import os, subprocess
|
| 2 |
import torch
|
| 3 |
|
|
|
|
| 111 |
css = '''
|
| 112 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
| 113 |
a {text-decoration-line: underline; font-weight: 600;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
'''
|
| 115 |
|
| 116 |
+
with gr.Blocks(css=css) as demo:
|
| 117 |
with gr.Column(elem_id="col-container"):
|
| 118 |
gr.HTML(title)
|
| 119 |
|
|
|
|
| 125 |
submit_btn = gr.Button("Submit")
|
| 126 |
|
| 127 |
output_text = gr.Textbox(label="Description Output", elem_id="output-txt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
examples=[['27E894C4-9375-48A1-A95D-CB2425416B4B.png', "best",4], ['DB362F56-BA98-4CA1-A999-A25AA94B723B.png',"fast",4]]
|
| 130 |
+
ex = gr.Examples(examples=examples, fn=inference, inputs=[input_image, mode_input, flavor_input], outputs=[output_text], cache_examples=False, run_on_click=True)
|
|
|
|
| 131 |
|
| 132 |
gr.HTML(article)
|
| 133 |
|
| 134 |
+
submit_btn.click(fn=inference, inputs=[input_image,mode_input,flavor_input], outputs=[output_text], api_name="clipi2")
|
|
|
|
| 135 |
|
| 136 |
+
demo.queue(max_size=32).launch(show_api=False)
|