Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,36 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
|
| 5 |
-
PORTED_SERVER_URL = "http://192.168.1.100:5000/upload" # Use the new VPS IP
|
| 6 |
|
| 7 |
def convert_exe_to_apk(file):
|
| 8 |
-
# Send the EXE to the ported server for conversion
|
| 9 |
files = {"file": file}
|
| 10 |
response = requests.post(PORTED_SERVER_URL, files=files)
|
| 11 |
|
| 12 |
if response.status_code == 200:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
else:
|
| 19 |
-
return "❌ Error converting EXE to APK."
|
| 20 |
-
|
| 21 |
-
# Gradio Interface
|
| 22 |
with gr.Blocks() as app:
|
| 23 |
-
gr.Markdown("## EXE to APK Converter
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
PORTED_SERVER_URL = "http://192.168.1.100:5000/upload"
|
|
|
|
| 5 |
|
| 6 |
def convert_exe_to_apk(file):
|
|
|
|
| 7 |
files = {"file": file}
|
| 8 |
response = requests.post(PORTED_SERVER_URL, files=files)
|
| 9 |
|
| 10 |
if response.status_code == 200:
|
| 11 |
+
apk_url = response.json().get("apk_url", None)
|
| 12 |
+
if apk_url:
|
| 13 |
+
return apk_url # Return the direct APK URL
|
| 14 |
+
return "❌ Error converting EXE to APK."
|
| 15 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
with gr.Blocks() as app:
|
| 17 |
+
gr.Markdown("## EXE to APK Converter")
|
| 18 |
+
|
| 19 |
+
upload_button = gr.File(label="Upload EXE File", type="file")
|
| 20 |
+
output_text = gr.Textbox(label="Download Link", interactive=False) # Shows the URL
|
| 21 |
+
download_button = gr.Button("Download APK", visible=False) # Initially hidden
|
| 22 |
+
|
| 23 |
+
def process_file(file):
|
| 24 |
+
apk_url = convert_exe_to_apk(file)
|
| 25 |
+
if "http" in apk_url:
|
| 26 |
+
return apk_url, gr.update(visible=True) # Show the button
|
| 27 |
+
return "❌ Conversion failed", gr.update(visible=False)
|
| 28 |
+
|
| 29 |
+
upload_button.change(process_file, inputs=upload_button, outputs=[output_text, download_button])
|
| 30 |
+
|
| 31 |
+
def open_download(url):
|
| 32 |
+
return gr.update(value=f"[Click Here to Download]({url})")
|
| 33 |
+
|
| 34 |
+
download_button.click(open_download, inputs=output_text, outputs=output_text)
|
| 35 |
|
| 36 |
app.launch()
|