Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,9 @@ import json
|
|
| 5 |
def minify_json(input_text, uploaded_file):
|
| 6 |
try:
|
| 7 |
if uploaded_file is not None:
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
# Load JSON content from input text or file
|
| 11 |
json_content = json.loads(input_text)
|
| 12 |
# Minify JSON (compact representation)
|
|
@@ -21,10 +22,10 @@ minify = gr.Interface(
|
|
| 21 |
"text"
|
| 22 |
)
|
| 23 |
|
| 24 |
-
#
|
| 25 |
def check_input(input_text, uploaded_file):
|
| 26 |
if uploaded_file is not None:
|
| 27 |
-
input_text = uploaded_file.
|
| 28 |
|
| 29 |
if not input_text.strip():
|
| 30 |
return "No words in the input."
|
|
|
|
| 5 |
def minify_json(input_text, uploaded_file):
|
| 6 |
try:
|
| 7 |
if uploaded_file is not None:
|
| 8 |
+
# Correct handling of the uploaded file
|
| 9 |
+
input_text = uploaded_file["data"].decode("utf-8")
|
| 10 |
+
|
| 11 |
# Load JSON content from input text or file
|
| 12 |
json_content = json.loads(input_text)
|
| 13 |
# Minify JSON (compact representation)
|
|
|
|
| 22 |
"text"
|
| 23 |
)
|
| 24 |
|
| 25 |
+
# Function for the Should we translate? interface
|
| 26 |
def check_input(input_text, uploaded_file):
|
| 27 |
if uploaded_file is not None:
|
| 28 |
+
input_text = uploaded_file["data"].decode("utf-8")
|
| 29 |
|
| 30 |
if not input_text.strip():
|
| 31 |
return "No words in the input."
|