Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import subprocess
|
| 3 |
+
import tempfile
|
| 4 |
+
import os
|
| 5 |
+
import shutil
|
| 6 |
+
|
| 7 |
+
def generate_apk(url):
|
| 8 |
+
with tempfile.TemporaryDirectory() as tmpdir:
|
| 9 |
+
output_apk = os.path.join(tmpdir, "output.apk")
|
| 10 |
+
try:
|
| 11 |
+
subprocess.run(["bash", "build_apk.sh", url, output_apk], check=True)
|
| 12 |
+
return output_apk
|
| 13 |
+
except subprocess.CalledProcessError as e:
|
| 14 |
+
return f"Error: {e}"
|
| 15 |
+
|
| 16 |
+
iface = gr.Interface(
|
| 17 |
+
fn=generate_apk,
|
| 18 |
+
inputs=gr.Textbox(label="PWA Manifest URL"),
|
| 19 |
+
outputs=gr.File(label="Download APK"),
|
| 20 |
+
title="PWA to APK Converter",
|
| 21 |
+
description="Enter the URL to your PWA manifest to generate a signed Android APK using Bubblewrap."
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
iface.launch()
|