Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
-
|
| 2 |
import json
|
| 3 |
|
| 4 |
-
app = Flask(__name__)
|
| 5 |
-
|
| 6 |
def extract_bq_codes_from_json(json_str):
|
| 7 |
try:
|
| 8 |
data = json.loads(json_str)
|
|
@@ -20,13 +18,12 @@ def extract_bq_codes_from_json(json_str):
|
|
| 20 |
codes.add(bqcode)
|
| 21 |
return list(codes)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
return render_template('index.html', result=None, json_input='')
|
| 30 |
|
| 31 |
-
if __name__ ==
|
| 32 |
-
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
import json
|
| 3 |
|
|
|
|
|
|
|
| 4 |
def extract_bq_codes_from_json(json_str):
|
| 5 |
try:
|
| 6 |
data = json.loads(json_str)
|
|
|
|
| 18 |
codes.add(bqcode)
|
| 19 |
return list(codes)
|
| 20 |
|
| 21 |
+
iface = gr.Interface(
|
| 22 |
+
fn=extract_bq_codes_from_json,
|
| 23 |
+
inputs=gr.Textbox(lines=10, label="JSON Input"),
|
| 24 |
+
outputs=gr.JSON(label="Extracted BQ Codes"),
|
| 25 |
+
title="BQ Code Extractor"
|
| 26 |
+
)
|
|
|
|
| 27 |
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
iface.launch()
|