Caslow commited on
Commit
4082b21
1 Parent(s): c63b084
Files changed (1) hide show
  1. app.py +26 -27
app.py CHANGED
@@ -10,41 +10,40 @@ def translate_fortran_to_rust(fortran_code):
10
  # rust_code = inference.testing(fortran_code)
11
  return fortran_code
12
 
13
- default_codes = """
14
- program sum_of_numbers\n
15
- implicit none\n
16
- integer :: n, i, sum\n\n
17
- ! Initialize variables\n
18
- sum = 0\n\n
19
- ! Get user input\n
20
- print *, \Enter a positive integer:\\n
21
- read *, n\n\n
22
- ! Calculate the sum of numbers from 1 to n\n
23
- do i = 1, n\n
24
- sum = sum + i\n
25
- end do\n\n
26
- ! Print the result\n
27
- print *, \The sum of numbers from 1 to\, n, \is\, sum\n
28
- end program sum_of_numbers
29
- """
30
 
31
- default_explanation ="""
32
- The provided Fortran code snippet is a program that calculates the sum of integers from 1 to n, where n is provided by the user.
33
- It uses a simple procedural approach, including variable declarations, input handling, and a loop for the summation.\n\n
34
- The functionality of the program is explained in detail in the elaboration. The program starts by initializing variables and prompting the user for input.
35
- It then calculates the sum using a do loop, iterating from 1 to n, and accumulating the result in a variable. Finally, it prints the computed sum to the console.\n\n
36
- This program demonstrates a straightforward application of Fortran's capabilities for handling loops and basic arithmetic operations.
37
- It is a clear example of how Fortran can be used to solve mathematical problems involving user interaction and iterative computations.
38
- """
39
 
40
  # Create the interface
41
 
42
  # Create and launch the Gradio interfac
43
  iface = gr.Interface(
44
  fn=translate_fortran_to_rust,
45
- inputs=[
46
  "textbox",
47
- ],
48
  outputs="textbox"
49
  # gr.Textbox(
50
  # lines=10,
 
10
  # rust_code = inference.testing(fortran_code)
11
  return fortran_code
12
 
13
+ # default_codes = """
14
+ # program sum_of_numbers\n
15
+ # implicit none\n
16
+ # integer :: n, i, sum\n\n
17
+ # ! Initialize variables\n
18
+ # sum = 0\n\n
19
+ # ! Get user input\n
20
+ # print *, \Enter a positive integer:\\n
21
+ # read *, n\n\n
22
+ # ! Calculate the sum of numbers from 1 to n\n
23
+ # do i = 1, n\n
24
+ # sum = sum + i\n
25
+ # end do\n\n
26
+ # ! Print the result\n
27
+ # print *, \The sum of numbers from 1 to\, n, \is\, sum\n
28
+ # end program sum_of_numbers
29
+ # """
30
 
31
+ # default_explanation ="""
32
+ # The provided Fortran code snippet is a program that calculates the sum of integers from 1 to n, where n is provided by the user.
33
+ # It uses a simple procedural approach, including variable declarations, input handling, and a loop for the summation.\n\n
34
+ # The functionality of the program is explained in detail in the elaboration. The program starts by initializing variables and prompting the user for input.
35
+ # It then calculates the sum using a do loop, iterating from 1 to n, and accumulating the result in a variable. Finally, it prints the computed sum to the console.\n\n
36
+ # This program demonstrates a straightforward application of Fortran's capabilities for handling loops and basic arithmetic operations.
37
+ # It is a clear example of how Fortran can be used to solve mathematical problems involving user interaction and iterative computations.
38
+ # """
39
 
40
  # Create the interface
41
 
42
  # Create and launch the Gradio interfac
43
  iface = gr.Interface(
44
  fn=translate_fortran_to_rust,
45
+ inputs=
46
  "textbox",
 
47
  outputs="textbox"
48
  # gr.Textbox(
49
  # lines=10,