Spaces:
Sleeping
Sleeping
Commit
·
d802802
1
Parent(s):
5712cc4
use Blocks
Browse files
app.py
CHANGED
|
@@ -103,34 +103,39 @@ def predict_by_text(head, body):
|
|
| 103 |
return h_result, b_result
|
| 104 |
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
demo.launch()
|
|
|
|
| 103 |
return h_result, b_result
|
| 104 |
|
| 105 |
|
| 106 |
+
with gr.Blocks() as demo:
|
| 107 |
+
btn = gr.Button("Classify")
|
| 108 |
+
|
| 109 |
+
@btn.click(
|
| 110 |
+
inputs=[
|
| 111 |
+
gr.Textbox(
|
| 112 |
+
label="Head",
|
| 113 |
+
info="http response head",
|
| 114 |
+
lines=6,
|
| 115 |
+
max_lines=10000,
|
| 116 |
+
value="200 OK",
|
| 117 |
+
),
|
| 118 |
+
gr.Textbox(
|
| 119 |
+
label="Body",
|
| 120 |
+
info="http response body",
|
| 121 |
+
lines=6,
|
| 122 |
+
max_lines=10000000000,
|
| 123 |
+
value="<body>The quick brown fox jumped over the lazy dogs.</body>",
|
| 124 |
+
),
|
| 125 |
+
],
|
| 126 |
+
outputs=[
|
| 127 |
+
gr.Textbox(
|
| 128 |
+
label="Head",
|
| 129 |
+
info="http response prediction",
|
| 130 |
+
),
|
| 131 |
+
gr.Textbox(
|
| 132 |
+
label="Body",
|
| 133 |
+
info="http response prediction",
|
| 134 |
+
),
|
| 135 |
+
],
|
| 136 |
+
)
|
| 137 |
+
def f(h, b):
|
| 138 |
+
return predict_by_text(h, b)
|
| 139 |
+
|
| 140 |
|
| 141 |
demo.launch()
|