Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import subprocess
|
| 3 |
|
| 4 |
# Clone the repository if not already present
|
|
@@ -8,10 +9,19 @@ if not os.path.exists("edge_vlm"):
|
|
| 8 |
# Install the required dependencies
|
| 9 |
subprocess.run(["pip", "install", "-r", "edge_vlm/requirements.txt"])
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
from model import MoondreamModel
|
| 16 |
import torch
|
| 17 |
import gradio as gr
|
|
|
|
| 1 |
import os
|
| 2 |
+
import shutil
|
| 3 |
import subprocess
|
| 4 |
|
| 5 |
# Clone the repository if not already present
|
|
|
|
| 9 |
# Install the required dependencies
|
| 10 |
subprocess.run(["pip", "install", "-r", "edge_vlm/requirements.txt"])
|
| 11 |
|
| 12 |
+
# Copy all files from edge_vlm to the current directory
|
| 13 |
+
source_dir = "edge_vlm"
|
| 14 |
+
destination_dir = "."
|
| 15 |
|
| 16 |
+
for filename in os.listdir(source_dir):
|
| 17 |
+
source_file = os.path.join(source_dir, filename)
|
| 18 |
+
destination_file = os.path.join(destination_dir, filename)
|
| 19 |
+
|
| 20 |
+
# Copy files, skipping directories like .git
|
| 21 |
+
if os.path.isfile(source_file):
|
| 22 |
+
shutil.copy(source_file, destination_file)
|
| 23 |
+
|
| 24 |
+
# Now import the model from the copied files
|
| 25 |
from model import MoondreamModel
|
| 26 |
import torch
|
| 27 |
import gradio as gr
|