Spaces:
Runtime error
Runtime error
EliottZemour
commited on
Commit
·
42fb932
1
Parent(s):
6a78287
center html
Browse files- app.py +9 -35
- htmlgen.ipynb +16 -13
app.py
CHANGED
@@ -49,23 +49,11 @@ CSS = """
|
|
49 |
margin-top: 10px;
|
50 |
}
|
51 |
.gradio-container .gr-button-primary {
|
52 |
-
background:
|
53 |
-
border: 1px solid #
|
54 |
border-radius: 8px;
|
55 |
-
color:
|
56 |
-
|
57 |
-
.gradio-container.dark button#submit-button {
|
58 |
-
background: linear-gradient(180deg, #CDF9BE 0%, #AFF497 100%);
|
59 |
-
border: 1px solid #B0DCCC;
|
60 |
-
border-radius: 8px;
|
61 |
-
color: #1B8700
|
62 |
-
}
|
63 |
-
table.gr-samples-table tr td {
|
64 |
-
border: none;
|
65 |
-
outline: none;
|
66 |
-
}
|
67 |
-
table.gr-samples-table tr td:first-of-type {
|
68 |
-
width: 0%;
|
69 |
}
|
70 |
|
71 |
gradio-app > div > div > div > div.w-full > div, .gradio-app > div > div > div > div.w-full > div {
|
@@ -74,9 +62,11 @@ gradio-app > div > div > div > div.w-full > div, .gradio-app > div > div > div >
|
|
74 |
gradio-app div div div div.w-full, .gradio-app div div div div.w-full {
|
75 |
gap: 0px;
|
76 |
}
|
77 |
-
|
78 |
-
|
|
|
79 |
}
|
|
|
80 |
#answer {
|
81 |
overflow-y: scroll;
|
82 |
color: white;
|
@@ -125,9 +115,8 @@ with demo:
|
|
125 |
elem_id="url-textbox",
|
126 |
)
|
127 |
button = gr.Button("Generate card", variant="primary")
|
128 |
-
clear_button = gr.Button("Clear")
|
129 |
with gr.Row():
|
130 |
-
card = gr.HTML()
|
131 |
|
132 |
button.click(
|
133 |
fn=create_html_card,
|
@@ -135,21 +124,6 @@ with demo:
|
|
135 |
outputs=[card]
|
136 |
)
|
137 |
|
138 |
-
clear_button.click(
|
139 |
-
lambda _: (
|
140 |
-
None,
|
141 |
-
None,
|
142 |
-
None,
|
143 |
-
gr.update(visible=False),
|
144 |
-
),
|
145 |
-
inputs=clear_button,
|
146 |
-
outputs=[
|
147 |
-
text,
|
148 |
-
button,
|
149 |
-
clear_button,
|
150 |
-
card,
|
151 |
-
],
|
152 |
-
)
|
153 |
|
154 |
|
155 |
if __name__ == "__main__":
|
|
|
49 |
margin-top: 10px;
|
50 |
}
|
51 |
.gradio-container .gr-button-primary {
|
52 |
+
background: #b31b1b;
|
53 |
+
border: 1px solid #b31b1b;
|
54 |
border-radius: 8px;
|
55 |
+
color: white;
|
56 |
+
font-weight: bold;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
gradio-app > div > div > div > div.w-full > div, .gradio-app > div > div > div > div.w-full > div {
|
|
|
62 |
gradio-app div div div div.w-full, .gradio-app div div div div.w-full {
|
63 |
gap: 0px;
|
64 |
}
|
65 |
+
|
66 |
+
#htel {
|
67 |
+
justify-content: center;
|
68 |
}
|
69 |
+
|
70 |
#answer {
|
71 |
overflow-y: scroll;
|
72 |
color: white;
|
|
|
115 |
elem_id="url-textbox",
|
116 |
)
|
117 |
button = gr.Button("Generate card", variant="primary")
|
|
|
118 |
with gr.Row():
|
119 |
+
card = gr.HTML(elem_id="htel")
|
120 |
|
121 |
button.click(
|
122 |
fn=create_html_card,
|
|
|
124 |
outputs=[card]
|
125 |
)
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
|
129 |
if __name__ == "__main__":
|
htmlgen.ipynb
CHANGED
@@ -384,7 +384,7 @@
|
|
384 |
},
|
385 |
{
|
386 |
"cell_type": "code",
|
387 |
-
"execution_count":
|
388 |
"metadata": {},
|
389 |
"outputs": [],
|
390 |
"source": [
|
@@ -397,16 +397,17 @@
|
|
397 |
"}\n",
|
398 |
"\n",
|
399 |
".gradio-container .gr-button-primary {\n",
|
400 |
-
" background:
|
401 |
-
" border: 1px solid #
|
402 |
" border-radius: 8px;\n",
|
403 |
-
" color:
|
|
|
404 |
"}\n",
|
405 |
".gradio-container.dark button#submit-button {\n",
|
406 |
" background: linear-gradient(180deg, #CDF9BE 0%, #AFF497 100%);\n",
|
407 |
" border: 1px solid #B0DCCC;\n",
|
408 |
" border-radius: 8px;\n",
|
409 |
-
" color: #
|
410 |
"}\n",
|
411 |
"table.gr-samples-table tr td {\n",
|
412 |
" border: none;\n",
|
@@ -424,9 +425,11 @@
|
|
424 |
"gradio-app div div div div.w-full, .gradio-app div div div div.w-full {\n",
|
425 |
" gap: 0px;\n",
|
426 |
"}\n",
|
427 |
-
"
|
428 |
-
"
|
|
|
429 |
"}\n",
|
|
|
430 |
"#answer {\n",
|
431 |
" overflow-y: scroll;\n",
|
432 |
" color: white;\n",
|
@@ -452,14 +455,14 @@
|
|
452 |
},
|
453 |
{
|
454 |
"cell_type": "code",
|
455 |
-
"execution_count":
|
456 |
"metadata": {},
|
457 |
"outputs": [
|
458 |
{
|
459 |
"name": "stdout",
|
460 |
"output_type": "stream",
|
461 |
"text": [
|
462 |
-
"Running on local URL: http://127.0.0.1:
|
463 |
"\n",
|
464 |
"To create a public link, set `share=True` in `launch()`.\n"
|
465 |
]
|
@@ -467,7 +470,7 @@
|
|
467 |
{
|
468 |
"data": {
|
469 |
"text/html": [
|
470 |
-
"<div><iframe src=\"http://127.0.0.1:
|
471 |
],
|
472 |
"text/plain": [
|
473 |
"<IPython.core.display.HTML object>"
|
@@ -479,10 +482,10 @@
|
|
479 |
{
|
480 |
"data": {
|
481 |
"text/plain": [
|
482 |
-
"(<gradio.routes.App at
|
483 |
]
|
484 |
},
|
485 |
-
"execution_count":
|
486 |
"metadata": {},
|
487 |
"output_type": "execute_result"
|
488 |
}
|
@@ -502,7 +505,7 @@
|
|
502 |
" )\n",
|
503 |
" button = gr.Button(\"Get\", variant=\"primary\")\n",
|
504 |
" with gr.Row():\n",
|
505 |
-
" card = gr.HTML()\n",
|
506 |
"\n",
|
507 |
" button.click(\n",
|
508 |
" fn=text_analysis,\n",
|
|
|
384 |
},
|
385 |
{
|
386 |
"cell_type": "code",
|
387 |
+
"execution_count": 29,
|
388 |
"metadata": {},
|
389 |
"outputs": [],
|
390 |
"source": [
|
|
|
397 |
"}\n",
|
398 |
"\n",
|
399 |
".gradio-container .gr-button-primary {\n",
|
400 |
+
" background: #b31b1b;\n",
|
401 |
+
" border: 1px solid #b31b1b;\n",
|
402 |
" border-radius: 8px;\n",
|
403 |
+
" color: white;\n",
|
404 |
+
" font-weight: bold;\n",
|
405 |
"}\n",
|
406 |
".gradio-container.dark button#submit-button {\n",
|
407 |
" background: linear-gradient(180deg, #CDF9BE 0%, #AFF497 100%);\n",
|
408 |
" border: 1px solid #B0DCCC;\n",
|
409 |
" border-radius: 8px;\n",
|
410 |
+
" color: #b31b1b\n",
|
411 |
"}\n",
|
412 |
"table.gr-samples-table tr td {\n",
|
413 |
" border: none;\n",
|
|
|
425 |
"gradio-app div div div div.w-full, .gradio-app div div div div.w-full {\n",
|
426 |
" gap: 0px;\n",
|
427 |
"}\n",
|
428 |
+
"\n",
|
429 |
+
"#htel {\n",
|
430 |
+
" justify-content: center;\n",
|
431 |
"}\n",
|
432 |
+
"\n",
|
433 |
"#answer {\n",
|
434 |
" overflow-y: scroll;\n",
|
435 |
" color: white;\n",
|
|
|
455 |
},
|
456 |
{
|
457 |
"cell_type": "code",
|
458 |
+
"execution_count": 30,
|
459 |
"metadata": {},
|
460 |
"outputs": [
|
461 |
{
|
462 |
"name": "stdout",
|
463 |
"output_type": "stream",
|
464 |
"text": [
|
465 |
+
"Running on local URL: http://127.0.0.1:7872/\n",
|
466 |
"\n",
|
467 |
"To create a public link, set `share=True` in `launch()`.\n"
|
468 |
]
|
|
|
470 |
{
|
471 |
"data": {
|
472 |
"text/html": [
|
473 |
+
"<div><iframe src=\"http://127.0.0.1:7872/\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
474 |
],
|
475 |
"text/plain": [
|
476 |
"<IPython.core.display.HTML object>"
|
|
|
482 |
{
|
483 |
"data": {
|
484 |
"text/plain": [
|
485 |
+
"(<gradio.routes.App at 0x157d354e0>, 'http://127.0.0.1:7872/', None)"
|
486 |
]
|
487 |
},
|
488 |
+
"execution_count": 30,
|
489 |
"metadata": {},
|
490 |
"output_type": "execute_result"
|
491 |
}
|
|
|
505 |
" )\n",
|
506 |
" button = gr.Button(\"Get\", variant=\"primary\")\n",
|
507 |
" with gr.Row():\n",
|
508 |
+
" card = gr.HTML(elem_id=\"htel\")\n",
|
509 |
"\n",
|
510 |
" button.click(\n",
|
511 |
" fn=text_analysis,\n",
|