Caslow commited on
Commit
ab15873
1 Parent(s): 4082b21
Files changed (1) hide show
  1. app.py +5 -63
app.py CHANGED
@@ -1,66 +1,8 @@
1
  import gradio as gr
2
 
3
- # def load_css():
4
- # with open('app.css', 'r') as file:
5
- # return file.read()
6
-
7
- def translate_fortran_to_rust(fortran_code):
8
- """Translate Fortran code to Rust using the provided model."""
9
- # Translation logic, with example stubbed function call
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,
50
- # label="Rust Code"
51
- # )
52
- # title="Fortran to Rust Code Translator",
53
- # description=(
54
- # "This tool translates Fortran code to Rust using a language model.\n\n"
55
- # "How to use:\n"
56
- # "1. Enter your Fortran code in the first text box\n"
57
- # "2. Add an explanation of the code in the second text box\n"
58
- # "3. The translated Rust code will appear in the output box\n\n"
59
- # "Note: The default model is a Llama-3.2-3B-Instruct"
60
- # ),
61
- # examples=[
62
- # [default_codes, default_explanation],
63
- # ]
64
- )
65
-
66
- iface.launch()
 
1
  import gradio as gr
2
 
3
+ def greet(name):
4
+ return "Hello " + name + "!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
+ demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
7
+
8
+ demo.launch() # Share your demo with just 1 extra parameter 🚀