Spaces:
Sleeping
Sleeping
Commit
·
a83d91e
1
Parent(s):
322a67e
model
Browse files
app.py
CHANGED
|
@@ -3,8 +3,21 @@ import gradio as gr
|
|
| 3 |
import tensorflow as tf
|
| 4 |
import numpy as np
|
| 5 |
import cv2
|
| 6 |
-
|
|
|
|
| 7 |
model_folder = 'plants_disease'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
with open(f'{model_folder}/labels.txt', 'r') as f:
|
| 9 |
labels = f.read().split('\n')
|
| 10 |
|
|
|
|
| 3 |
import tensorflow as tf
|
| 4 |
import numpy as np
|
| 5 |
import cv2
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
model_folder = 'plants_disease'
|
| 9 |
+
destination = model_folder
|
| 10 |
+
|
| 11 |
+
if not os.path.exists(destination):
|
| 12 |
+
import subprocess
|
| 13 |
+
repo_url = os.getenv("GIT_CORE")
|
| 14 |
+
command = f'git clone {repo_url} {destination}'
|
| 15 |
+
try:
|
| 16 |
+
subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)#, env=env)
|
| 17 |
+
print('Repository cloned successfully.')
|
| 18 |
+
except subprocess.CalledProcessError as e:
|
| 19 |
+
print(f'Error cloning repository: {e.output.decode()}')
|
| 20 |
+
# %%
|
| 21 |
with open(f'{model_folder}/labels.txt', 'r') as f:
|
| 22 |
labels = f.read().split('\n')
|
| 23 |
|