Update README.md
Browse files
README.md
CHANGED
@@ -384,6 +384,7 @@ def build_display_text(opo_n):
|
|
384 |
```
|
385 |
|
386 |
Here it will be generate 4 random opportunities
|
|
|
387 |
```python
|
388 |
opo_n_one = random.randrange(len(opo))
|
389 |
opo_n_two = random.randrange(len(opo))
|
@@ -391,7 +392,10 @@ opo_n_three = random.randrange(len(opo))
|
|
391 |
opo_n_four = random.randrange(len(opo))
|
392 |
|
393 |
evaluated = []
|
|
|
394 |
|
|
|
|
|
395 |
def predict_next(option, nota):
|
396 |
global userID
|
397 |
global opo_n_one
|
@@ -401,9 +405,9 @@ def predict_next(option, nota):
|
|
401 |
global evaluated
|
402 |
global opo
|
403 |
global simulation
|
404 |
-
|
405 |
selected = [opo_n_one, opo_n_two, opo_n_three, opo_n_four][int(option)-1]
|
406 |
-
|
407 |
simulation = simulation.append({'userID': userID, 'itemID': selected, 'rating': nota}, ignore_index=True)
|
408 |
evaluated.append(selected)
|
409 |
|
@@ -432,7 +436,11 @@ def predict_next(option, nota):
|
|
432 |
opo_n_four = items[est.index(sorted(est)[-4])]
|
433 |
|
434 |
return build_display_text(opo_n_one), build_display_text(opo_n_two), build_display_text(opo_n_three), build_display_text(opo_n_four)
|
|
|
|
|
|
|
435 |
|
|
|
436 |
|
437 |
with gr.Blocks() as demo:
|
438 |
with gr.Row():
|
@@ -457,7 +465,9 @@ with gr.Blocks() as demo:
|
|
457 |
outputs=[one_opo, two_opo, three_opo, four_opo])
|
458 |
|
459 |
if __name__ == "__main__":
|
460 |
-
demo.launch()
|
|
|
|
|
461 |
## Benchmarks
|
462 |
|
463 |
```python
|
|
|
384 |
```
|
385 |
|
386 |
Here it will be generate 4 random opportunities
|
387 |
+
|
388 |
```python
|
389 |
opo_n_one = random.randrange(len(opo))
|
390 |
opo_n_two = random.randrange(len(opo))
|
|
|
392 |
opo_n_four = random.randrange(len(opo))
|
393 |
|
394 |
evaluated = []
|
395 |
+
```
|
396 |
|
397 |
+
```python
|
398 |
+
This function predict the
|
399 |
def predict_next(option, nota):
|
400 |
global userID
|
401 |
global opo_n_one
|
|
|
405 |
global evaluated
|
406 |
global opo
|
407 |
global simulation
|
408 |
+
# the "selected" takes the number, on our database, of the rated opportunity
|
409 |
selected = [opo_n_one, opo_n_two, opo_n_three, opo_n_four][int(option)-1]
|
410 |
+
# Here is created a new database called simulation, that takes the previous simulation then adds a new line with te ID of the user, the rated item and the rate. integrates the selected opportunity
|
411 |
simulation = simulation.append({'userID': userID, 'itemID': selected, 'rating': nota}, ignore_index=True)
|
412 |
evaluated.append(selected)
|
413 |
|
|
|
436 |
opo_n_four = items[est.index(sorted(est)[-4])]
|
437 |
|
438 |
return build_display_text(opo_n_one), build_display_text(opo_n_two), build_display_text(opo_n_three), build_display_text(opo_n_four)
|
439 |
+
```
|
440 |
+
|
441 |
+
Here we have the interation of gradio, that allows the construction of the app
|
442 |
|
443 |
+
```python
|
444 |
|
445 |
with gr.Blocks() as demo:
|
446 |
with gr.Row():
|
|
|
465 |
outputs=[one_opo, two_opo, three_opo, four_opo])
|
466 |
|
467 |
if __name__ == "__main__":
|
468 |
+
demo.launch()
|
469 |
+
```
|
470 |
+
|
471 |
## Benchmarks
|
472 |
|
473 |
```python
|