kjn1009 commited on
Commit
d82d587
ยท
verified ยท
1 Parent(s): 9d2c6fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,11 +4,12 @@ from torchvision import models
4
  from PIL import Image
5
  import gradio as gr
6
 
7
- # ๋ชจ๋ธ ํด๋ž˜์Šค ์ •์˜ (์˜ˆ: EfficientNet)
8
  class MyModel(torch.nn.Module):
9
  def __init__(self, num_classes):
10
  super(MyModel, self).__init__()
11
- self.model = models.efficientnet_b0(pretrained=False, num_classes=num_classes)
 
12
 
13
  def forward(self, x):
14
  return self.model(x)
@@ -42,4 +43,4 @@ def predict(image):
42
 
43
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
44
  iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs='label', live=True)
45
- iface.launch()
 
4
  from PIL import Image
5
  import gradio as gr
6
 
7
+ # ๋ชจ๋ธ ํด๋ž˜์Šค ์ •์˜ (ResNet18)
8
  class MyModel(torch.nn.Module):
9
  def __init__(self, num_classes):
10
  super(MyModel, self).__init__()
11
+ self.model = models.resnet18(pretrained=False) # ResNet18 ๋ชจ๋ธ ์‚ฌ์šฉ
12
+ self.model.fc = torch.nn.Linear(self.model.fc.in_features, num_classes) # ๋งˆ์ง€๋ง‰ ๋ ˆ์ด์–ด ์ˆ˜์ •
13
 
14
  def forward(self, x):
15
  return self.model(x)
 
43
 
44
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
45
  iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs='label', live=True)
46
+ iface.launch()