chap0lin commited on
Commit
5a5b5b2
1 Parent(s): f3dd9f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -44,11 +44,8 @@ class callback(CallbackAny2Vec):
44
  self.epoch+= 1
45
  self.loss_previous_step = loss
46
 
47
- # get_model("word2vec_xp8.model", "https://github.com/chap0lin/PPF-MCTI/blob/master/Meta10/pesos/word2vec/word2vec_xp8.model?raw=true")
48
  reloaded_w2v_model = Word2Vec.load('word2vec_xp8.model')
49
 
50
- # get_model("best weights CNN.h5", "https://github.com/chap0lin/PPF-MCTI/blob/master/Meta10/pesos/word2vec/best%20weights%20CNN.h5?raw=true")
51
-
52
  reconstructed_model_CNN = keras.models.load_model("best weights CNN.h5",
53
  custom_objects={'f1_m':f1_m,
54
  "precision_m":precision_m,
@@ -67,8 +64,12 @@ def greet(sentence):
67
 
68
 
69
  # pad 2726
 
70
 
71
- return reconstructed_model_CNN.predict(MCTIinput_vector)
 
 
 
72
 
73
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
74
  iface.launch()
 
44
  self.epoch+= 1
45
  self.loss_previous_step = loss
46
 
 
47
  reloaded_w2v_model = Word2Vec.load('word2vec_xp8.model')
48
 
 
 
49
  reconstructed_model_CNN = keras.models.load_model("best weights CNN.h5",
50
  custom_objects={'f1_m':f1_m,
51
  "precision_m":precision_m,
 
64
 
65
 
66
  # pad 2726
67
+ value = reconstructed_model_CNN.predict(MCTIinput_vector)[0]
68
 
69
+ if value >= 0.5:
70
+ return gr.Image(source = "elegivel.png")
71
+ else:
72
+ return gr.Image(source = "inelegivel.png")
73
 
74
+ iface = gr.Interface(fn=greet, inputs="text", outputs="image")
75
  iface.launch()