Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,6 +35,19 @@ TOKEN = "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"
|
|
| 35 |
|
| 36 |
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
def load_model(file_name: str, path:str,device: torch.device) -> nn.Module:
|
| 39 |
path = hf_hub_download(f'{path}',
|
| 40 |
f'{file_name}',
|
|
@@ -59,7 +72,10 @@ def main():
|
|
| 59 |
#else:
|
| 60 |
# ini = "False1"
|
| 61 |
#result = subprocess.check_output(['nvidia-smi'])
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
iface = gr.Interface(
|
| 65 |
fn=predict,
|
|
|
|
| 35 |
|
| 36 |
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 37 |
|
| 38 |
+
def parse_args() -> argparse.Namespace:
|
| 39 |
+
parser = argparse.ArgumentParser()
|
| 40 |
+
parser.add_argument('--device', type=str, default='cpu')
|
| 41 |
+
parser.add_argument('--theme', type=str)
|
| 42 |
+
parser.add_argument('--live', action='store_true')
|
| 43 |
+
parser.add_argument('--share', action='store_true')
|
| 44 |
+
parser.add_argument('--port', type=int)
|
| 45 |
+
parser.add_argument('--disable-queue',
|
| 46 |
+
dest='enable_queue',
|
| 47 |
+
action='store_false')
|
| 48 |
+
parser.add_argument('--allow-flagging', type=str, default='never')
|
| 49 |
+
return parser.parse_args()
|
| 50 |
+
|
| 51 |
def load_model(file_name: str, path:str,device: torch.device) -> nn.Module:
|
| 52 |
path = hf_hub_download(f'{path}',
|
| 53 |
f'{file_name}',
|
|
|
|
| 72 |
#else:
|
| 73 |
# ini = "False1"
|
| 74 |
#result = subprocess.check_output(['nvidia-smi'])
|
| 75 |
+
|
| 76 |
+
args = parse_args()
|
| 77 |
+
device = torch.device(args.device)
|
| 78 |
+
load_model("stylegan2-ffhq-config-f","feng2022/Time-TravelRephotography_stylegan2-ffhq-config-f",device)
|
| 79 |
|
| 80 |
iface = gr.Interface(
|
| 81 |
fn=predict,
|