Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
# Ported server URL (your VPS address)
|
| 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 |
+
# Extract the APK download link from the server's response
|
| 14 |
+
apk_url = response.json().get("apk_url", "Error: No link returned")
|
| 15 |
+
|
| 16 |
+
# Return the download URL for Gradio
|
| 17 |
+
return apk_url
|
| 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 (Using Ported Server)")
|
| 24 |
+
|
| 25 |
+
# Upload Button
|
| 26 |
+
upload_button = gr.UploadButton("Upload EXE File", file_types=[".exe"])
|
| 27 |
+
|
| 28 |
+
# Download button (used to show the APK download link)
|
| 29 |
+
download_button = gr.Button("Download APK")
|
| 30 |
+
|
| 31 |
+
# Action: When EXE is uploaded, the download button is shown with the link
|
| 32 |
+
download_button.click(convert_exe_to_apk, inputs=upload_button, outputs=download_button)
|
| 33 |
+
|
| 34 |
+
app.launch()
|