MihaiPopa-1 commited on
Commit
845fe35
·
verified ·
1 Parent(s): fb69759

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import torch
3
  import torch.nn as nn
4
  import torch.nn.functional as F
@@ -28,8 +29,12 @@ class TinySR(nn.Module):
28
  return self.output(x)
29
 
30
  # --- 2️⃣ Load trained model ---
 
 
 
 
31
  model = TinySR(channels=32, blocks=8)
32
- model.load_state_dict(torch.load("tinysr_model.pt", map_location="cpu"))
33
  model.eval()
34
 
35
  # --- 3️⃣ Inference function ---
@@ -62,8 +67,7 @@ iface = gr.Interface(
62
  inputs=gr.Audio(type="filepath", label="Upload 16 kHz Mono WAV"),
63
  outputs=gr.Audio(type="filepath", label="Upscaled 48 kHz WAV"),
64
  title=title,
65
- description=description,
66
- allow_flagging="never"
67
  )
68
 
69
  iface.launch()
 
1
  import gradio as gr
2
+ from huggingface_hub import hf_hub_download
3
  import torch
4
  import torch.nn as nn
5
  import torch.nn.functional as F
 
29
  return self.output(x)
30
 
31
  # --- 2️⃣ Load trained model ---
32
+ weights_path = hf_hub_download(
33
+ repo_id="MihaiPopa-1/TinySR",
34
+ filename="tinysr_model.pt"
35
+ )
36
  model = TinySR(channels=32, blocks=8)
37
+ model.load_state_dict(torch.load(weights_path, map_location="cpu"))
38
  model.eval()
39
 
40
  # --- 3️⃣ Inference function ---
 
67
  inputs=gr.Audio(type="filepath", label="Upload 16 kHz Mono WAV"),
68
  outputs=gr.Audio(type="filepath", label="Upscaled 48 kHz WAV"),
69
  title=title,
70
+ description=description
 
71
  )
72
 
73
  iface.launch()