Spaces:
Running
Running
Sadjad Alikhani
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,9 @@ import numpy as np
|
|
| 5 |
import pickle
|
| 6 |
import io
|
| 7 |
import sys
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Paths to the predefined images folder
|
| 10 |
RAW_PATH = os.path.join("images", "raw")
|
|
@@ -40,9 +43,6 @@ def display_predefined_images(percentage_idx, complexity_idx):
|
|
| 40 |
|
| 41 |
return raw_image, embeddings_image
|
| 42 |
|
| 43 |
-
import torch
|
| 44 |
-
import subprocess
|
| 45 |
-
|
| 46 |
# Function to load the pre-trained model from your cloned repository
|
| 47 |
def load_custom_model():
|
| 48 |
from lwm_model import LWM # Assuming the model is defined in lwm_model.py
|
|
@@ -50,13 +50,6 @@ def load_custom_model():
|
|
| 50 |
model.eval()
|
| 51 |
return model
|
| 52 |
|
| 53 |
-
import sys
|
| 54 |
-
import subprocess
|
| 55 |
-
import os
|
| 56 |
-
import pickle
|
| 57 |
-
import torch
|
| 58 |
-
import io
|
| 59 |
-
|
| 60 |
# Function to process the uploaded .p file and perform inference using the custom model
|
| 61 |
def process_p_file(uploaded_file, percentage_idx, complexity_idx):
|
| 62 |
capture = PrintCapture()
|
|
|
|
| 5 |
import pickle
|
| 6 |
import io
|
| 7 |
import sys
|
| 8 |
+
import torch
|
| 9 |
+
import torch
|
| 10 |
+
import subprocess
|
| 11 |
|
| 12 |
# Paths to the predefined images folder
|
| 13 |
RAW_PATH = os.path.join("images", "raw")
|
|
|
|
| 43 |
|
| 44 |
return raw_image, embeddings_image
|
| 45 |
|
|
|
|
|
|
|
|
|
|
| 46 |
# Function to load the pre-trained model from your cloned repository
|
| 47 |
def load_custom_model():
|
| 48 |
from lwm_model import LWM # Assuming the model is defined in lwm_model.py
|
|
|
|
| 50 |
model.eval()
|
| 51 |
return model
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
# Function to process the uploaded .p file and perform inference using the custom model
|
| 54 |
def process_p_file(uploaded_file, percentage_idx, complexity_idx):
|
| 55 |
capture = PrintCapture()
|