medasaicharan2 commited on
Commit
1362446
1 Parent(s): 472ab9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -44,7 +44,7 @@ def pre_process(image, model_name):
44
  img = image.convert("L")
45
 
46
  # Select model based on the dropdown selection
47
- if model_name == "cnn":
48
  model = mnist_cnn_model
49
  img = img.resize((28, 28))
50
  img = np.array(img) / 255.0
@@ -52,7 +52,7 @@ def pre_process(image, model_name):
52
  pred = model.predict(final_img)
53
  result = np.argmax(pred)
54
  return str(result)
55
- elif model_name == "mcdnn":
56
  model = mnist_mcdnn_model
57
  img = img.resize((28, 28))
58
  img = np.array(img) / 255.0
@@ -60,16 +60,16 @@ def pre_process(image, model_name):
60
  pred = model.predict(final_img)
61
  result = np.argmax(pred)
62
  return str(result)
63
- elif model_name == "OCR - preferred":
64
  pred = run(image)
65
  return pred
66
- elif model_name == "TROCR":
67
  return trocr_predict(image)
68
  else:
69
  return "Invalid model selection"
70
 
71
  # Defining model options for dropdown
72
- model_options = ["cnn", "mcdnn", "OCR - preferred", "TROCR"]
73
 
74
 
75
  with gr.Blocks() as demo:
 
44
  img = image.convert("L")
45
 
46
  # Select model based on the dropdown selection
47
+ if model_name == "Simple CNN":
48
  model = mnist_cnn_model
49
  img = img.resize((28, 28))
50
  img = np.array(img) / 255.0
 
52
  pred = model.predict(final_img)
53
  result = np.argmax(pred)
54
  return str(result)
55
+ elif model_name == "MCDNN":
56
  model = mnist_mcdnn_model
57
  img = img.resize((28, 28))
58
  img = np.array(img) / 255.0
 
60
  pred = model.predict(final_img)
61
  result = np.argmax(pred)
62
  return str(result)
63
+ elif model_name == "OCR":
64
  pred = run(image)
65
  return pred
66
+ elif model_name == "CNN BI-LSTM":
67
  return trocr_predict(image)
68
  else:
69
  return "Invalid model selection"
70
 
71
  # Defining model options for dropdown
72
+ model_options = ["Simple CNN", "MCDNN", "OCR", "CNN BI-LSTM"]
73
 
74
 
75
  with gr.Blocks() as demo: