Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import spaces
|
| 3 |
#import training
|
| 4 |
-
import model_compiler
|
|
|
|
| 5 |
from huggingface_hub import HfApi
|
| 6 |
from huggingface_hub import whoami
|
| 7 |
|
| 8 |
-
compiler = model_compiler.model_compiler()
|
| 9 |
|
| 10 |
# Get top-level authorizations
|
| 11 |
oauth_info = {'username' : None, 'token' : None}
|
|
@@ -31,8 +32,20 @@ def get_oauth_info(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken |
|
|
| 31 |
|
| 32 |
def compile_model(model_name):
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# try:
|
| 38 |
# epochs = int(epochs_text)
|
|
@@ -45,7 +58,7 @@ def compile_model(model_name):
|
|
| 45 |
# Run the training
|
| 46 |
# return model.run_training(epochs=epochs, batch=batch)
|
| 47 |
|
| 48 |
-
return f"Compiled model {
|
| 49 |
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
gr.LoginButton()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
#import spaces
|
| 3 |
#import training
|
| 4 |
+
#import model_compiler
|
| 5 |
+
import sr100_model_compiler
|
| 6 |
from huggingface_hub import HfApi
|
| 7 |
from huggingface_hub import whoami
|
| 8 |
|
| 9 |
+
#compiler = model_compiler.model_compiler()
|
| 10 |
|
| 11 |
# Get top-level authorizations
|
| 12 |
oauth_info = {'username' : None, 'token' : None}
|
|
|
|
| 32 |
|
| 33 |
def compile_model(model_name):
|
| 34 |
|
| 35 |
+
# Run the comparison
|
| 36 |
+
mode = 'hello_world.tflite'
|
| 37 |
+
out_dir = './tmp'
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
results = sr100_model_compiler.sr100_model_compiler(
|
| 41 |
+
model_file=model,
|
| 42 |
+
output_dir=f"{out_dir}",
|
| 43 |
+
model_loc=f"{model_loc}",
|
| 44 |
+
)
|
| 45 |
+
print(results)
|
| 46 |
+
|
| 47 |
+
default_config = sr100_model_compiler.sr100_default_config()
|
| 48 |
+
success, perf_data = sr100_model_compiler.sr100_check_model(results=results, config=default_config)
|
| 49 |
|
| 50 |
# try:
|
| 51 |
# epochs = int(epochs_text)
|
|
|
|
| 58 |
# Run the training
|
| 59 |
# return model.run_training(epochs=epochs, batch=batch)
|
| 60 |
|
| 61 |
+
return f"Compiled model {success} {perf_data}"
|
| 62 |
|
| 63 |
with gr.Blocks() as demo:
|
| 64 |
gr.LoginButton()
|