Spaces:
Running
Running
Commit
Β·
22247e1
1
Parent(s):
da8f23d
fixes
Browse files
app2.py
CHANGED
@@ -1392,7 +1392,7 @@ def create_modern_interface():
|
|
1392 |
|
1393 |
return viewport_html
|
1394 |
|
1395 |
-
def process_inputs(urls, files, text, combine):
|
1396 |
"""Process all inputs and generate QR codes"""
|
1397 |
results = []
|
1398 |
processing_status_messages = []
|
@@ -1480,7 +1480,10 @@ def create_modern_interface():
|
|
1480 |
def on_qr_generation(qr_paths_list):
|
1481 |
# When QR codes are generated, update the state with the list of paths
|
1482 |
# and initialize the enabled_qr_codes state with all indices enabled
|
1483 |
-
|
|
|
|
|
|
|
1484 |
initial_enabled_states = list(range(num_qrs))
|
1485 |
return qr_paths_list, initial_enabled_states # Return paths list and initial enabled state
|
1486 |
|
|
|
1392 |
|
1393 |
return viewport_html
|
1394 |
|
1395 |
+
def process_inputs(urls, files, text, combine, *args):
|
1396 |
"""Process all inputs and generate QR codes"""
|
1397 |
results = []
|
1398 |
processing_status_messages = []
|
|
|
1480 |
def on_qr_generation(qr_paths_list):
|
1481 |
# When QR codes are generated, update the state with the list of paths
|
1482 |
# and initialize the enabled_qr_codes state with all indices enabled
|
1483 |
+
if qr_paths_list is None:
|
1484 |
+
num_qrs=0
|
1485 |
+
else:
|
1486 |
+
num_qrs=len(qr_paths_list)
|
1487 |
initial_enabled_states = list(range(num_qrs))
|
1488 |
return qr_paths_list, initial_enabled_states # Return paths list and initial enabled state
|
1489 |
|
fix.sh
CHANGED
@@ -1,24 +1,27 @@
|
|
1 |
#!/bin/bash
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
PYTH_DIR="/usr/local/lib/python3.10/site-packages/pyth"
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
echo "β pyth directory not found: $PYTH_DIR"
|
9 |
-
exit 1
|
10 |
-
fi
|
11 |
|
12 |
-
echo "
|
13 |
|
14 |
-
|
15 |
-
find "$PYTH_DIR" -type f -name "*.py" -exec sed -i 's/ur"/r"/g' {} +
|
16 |
-
find "$PYTH_DIR" -type f -name "*.py" -exec sed -i "s/ur'/r'/g" {} +
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
20 |
|
21 |
-
|
22 |
-
find "$PYTH_DIR" -type f -name "*.py" -exec sed -i 's/\.iteritems()/\.items()/g' {} +
|
23 |
|
24 |
-
echo "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#!/bin/bash
|
2 |
+
# Fix script for app2.py and Gradio version
|
3 |
+
# Applies only necessary surgical fixes without changing unrelated code
|
4 |
|
5 |
+
echo "π Fixing 'len(None)' error on qr_paths_list in app2.py..."
|
|
|
6 |
|
7 |
+
# Patch to safely handle NoneType for qr_paths_list
|
8 |
+
sed -i 's/num_qrs = len(qr_paths_list)/if qr_paths_list is None:\n num_qrs=0\nelse:\n num_qrs=len(qr_paths_list)/' /home/user/app/app2.py
|
|
|
|
|
|
|
9 |
|
10 |
+
echo "β
Fixed qr_paths_list NoneType issue."
|
11 |
|
12 |
+
echo "π Fixing Gradio process_inputs() TypeError..."
|
|
|
|
|
13 |
|
14 |
+
# Patch your process_inputs definition to accept optional args
|
15 |
+
# (Only if 'def process_inputs' exists)
|
16 |
+
sed -i '/def process_inputs(/ s/):$/, *args):/' /home/user/app/app2.py
|
17 |
|
18 |
+
echo "β
Fixed process_inputs() to tolerate extra args."
|
|
|
19 |
|
20 |
+
echo "π Downgrading Gradio version for compatibility (~3.50)..."
|
21 |
+
|
22 |
+
# Downgrade Gradio
|
23 |
+
pip install 'gradio>=3.40,<3.60' --force-reinstall
|
24 |
+
|
25 |
+
echo "β
Gradio downgraded to compatible version."
|
26 |
+
|
27 |
+
echo "π― All fixes applied. Restart your app if needed."
|