GabrielMI commited on
Commit
ce8dd05
verified
1 Parent(s): f02c929

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -2,10 +2,18 @@ from huggingface_hub import from_pretrained_fastai
2
  import gradio as gr
3
  from fastai.text.all import *
4
 
 
 
 
 
 
 
 
 
5
  repo_id = "GabrielMI/entregable3"
6
 
7
  learner = from_pretrained_fastai(repo_id)
8
- labels = ["Python", "Java", "C++", "Fortran", "Go"]
9
 
10
  def predict(text):
11
  pred, pred_idx, probs = learner.predict(text)
@@ -15,4 +23,5 @@ gr.Interface(
15
  fn=predict,
16
  inputs=[gr.Textbox(label="Instrucciones")],
17
  outputs=gr.Label(num_top_classes=3),
 
18
  ).launch(share=False)
 
2
  import gradio as gr
3
  from fastai.text.all import *
4
 
5
+ examples = [
6
+ ["// Esto es c贸digo 'Hello World' en C++\\n#include <iostream>\\nint main() {\\n std::cout << \\\"Hello World\\\" << std::endl;\\n return 0;\\n}"],
7
+ ["! Esto es c贸digo 'Hello World' en Fortran\\nprogram hello\\n print *, \\\"Hello World\\\"\\nend program hello"],
8
+ ["// Esto es c贸digo 'Hello World' en Go\\npackage main\\nimport \\\"fmt\\\"\\n\\nfunc main() {\\n fmt.Println(\\\"Hello World\\\")\\n}"],
9
+ ["// Esto es c贸digo 'Hello World' en Java\\npublic class Main {\\n public static void main(String[] args) {\\n System.out.println(\\\"Hello World\\\");\\n }\\n}"],
10
+ ["# Esto es c贸digo 'Hello World' en Python\\nprint(\\\"Hello World\\\")"]
11
+ ]
12
+
13
  repo_id = "GabrielMI/entregable3"
14
 
15
  learner = from_pretrained_fastai(repo_id)
16
+ labels = ["C++", "Fortran", "Go", "Java", "Python"]
17
 
18
  def predict(text):
19
  pred, pred_idx, probs = learner.predict(text)
 
23
  fn=predict,
24
  inputs=[gr.Textbox(label="Instrucciones")],
25
  outputs=gr.Label(num_top_classes=3),
26
+ examples=examples
27
  ).launch(share=False)