Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,23 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
def generate_ipa(app_name, bundle_id, website_url, app_icon):
|
| 6 |
try:
|
| 7 |
-
#
|
| 8 |
app_icon_path = os.path.join("/tmp", app_icon.name)
|
|
|
|
|
|
|
| 9 |
with open(app_icon_path, "wb") as f:
|
| 10 |
-
|
| 11 |
|
| 12 |
# Now trigger the Docker container to build the IPA
|
| 13 |
command = [
|
| 14 |
"docker", "run", "--rm",
|
| 15 |
-
"-v", f"{app_icon_path}:/app/icon.png", #
|
| 16 |
-
"-v", f"{os.getcwd()}/output:/app/output", #
|
| 17 |
-
"ios-ipa-builder", # The
|
| 18 |
app_name, bundle_id, website_url
|
| 19 |
]
|
| 20 |
|
|
@@ -23,7 +26,7 @@ def generate_ipa(app_name, bundle_id, website_url, app_icon):
|
|
| 23 |
|
| 24 |
# Check the result
|
| 25 |
if result.returncode == 0:
|
| 26 |
-
ipa_path = "/app/output/your_ipa_file.ipa" # Adjust to actual file name
|
| 27 |
return f"IPA file successfully generated! You can download it here: {ipa_path}"
|
| 28 |
else:
|
| 29 |
return f"Error during IPA generation: {result.stderr}"
|
|
@@ -44,3 +47,4 @@ iface = gr.Interface(
|
|
| 44 |
)
|
| 45 |
|
| 46 |
iface.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
import os
|
| 4 |
+
import shutil
|
| 5 |
|
| 6 |
def generate_ipa(app_name, bundle_id, website_url, app_icon):
|
| 7 |
try:
|
| 8 |
+
# Create a temporary path to store the app icon file
|
| 9 |
app_icon_path = os.path.join("/tmp", app_icon.name)
|
| 10 |
+
|
| 11 |
+
# Write the uploaded file to the temp directory
|
| 12 |
with open(app_icon_path, "wb") as f:
|
| 13 |
+
shutil.copyfileobj(app_icon.file, f) # Copy content to the temp file
|
| 14 |
|
| 15 |
# Now trigger the Docker container to build the IPA
|
| 16 |
command = [
|
| 17 |
"docker", "run", "--rm",
|
| 18 |
+
"-v", f"{app_icon_path}:/app/icon.png", # Mount the app icon to the container
|
| 19 |
+
"-v", f"{os.getcwd()}/output:/app/output", # Mount output directory for the IPA file
|
| 20 |
+
"ios-ipa-builder", # The name of the Docker image
|
| 21 |
app_name, bundle_id, website_url
|
| 22 |
]
|
| 23 |
|
|
|
|
| 26 |
|
| 27 |
# Check the result
|
| 28 |
if result.returncode == 0:
|
| 29 |
+
ipa_path = "/app/output/your_ipa_file.ipa" # Adjust to the actual IPA file name
|
| 30 |
return f"IPA file successfully generated! You can download it here: {ipa_path}"
|
| 31 |
else:
|
| 32 |
return f"Error during IPA generation: {result.stderr}"
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
iface.launch()
|
| 50 |
+
|