First commit
Browse files- .gitignore +4 -0
- app.py +15 -12
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
main.py
|
3 |
+
encode.sh
|
4 |
+
encoded_app.txt
|
app.py
CHANGED
@@ -1,16 +1,19 @@
|
|
1 |
import os
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
raise RuntimeError(f"An error occurred while running the app: {e}") from e
|
|
|
1 |
import os
|
2 |
+
import base64
|
3 |
+
import gradio as gr
|
4 |
|
5 |
+
# Load the APP environment variable
|
6 |
+
app_code = os.getenv("APP")
|
7 |
+
|
8 |
+
if not app_code:
|
9 |
+
raise ValueError("The APP environment variable is not set.")
|
10 |
|
11 |
+
# Decode the app_code (assuming it's encoded, e.g., using Base64)
|
12 |
+
decoded_app_code = base64.b64decode(app_code).decode("utf-8")
|
13 |
|
14 |
+
# Execute the decoded code in the global scope
|
15 |
+
exec(decoded_app_code)
|
16 |
+
|
17 |
+
# If the code contains a Gradio app (like `demo`), it will launch when executed
|
18 |
+
if __name__ == "__main__":
|
19 |
+
demo.launch()
|
|