ramyaa1113 commited on
Commit
fbfa58f
·
1 Parent(s): 8c85c78

App updated

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -2,30 +2,26 @@ import os
2
  import gradio as gr
3
  from translator.agent import TranslationAgent
4
 
5
- #Initialize agent (will load mapping table)
6
  agent = TranslationAgent()
7
 
8
-
9
  def do_translate(csharp_code, target_format, model_choice):
10
- #taget format : "cpp", "BP", "both"
11
  return agent.translate(csharp_code, target_format=target_format, model_choice=model_choice)
12
 
13
- title = "Unity -> Unreal Code Translator"
14
  description = "Paste a Unity C# script and get suggested Unreal C++ (.h/.cpp) and an Unreal Python Blueprint-generator script."
15
 
16
- gradioInterface = gr.Interface(
17
- #function
18
  fn=do_translate,
19
- #input field
20
  inputs=[
21
- gr.Textbox(lines=25, lable="Unity C# Code"),
22
- gr.Radio(["cpp", "Blueprint","Both"], value="Both", lable="Target Code"),
23
- gr.Radio(["hf_inference", "openai"], value="openai", lable="Model Backend")
24
  ],
25
- #Output field
26
  outputs=[
27
- gr.Textbox(lines=20, lable="Unreal C++ (.h/.cpp"),
28
- gr.Textbox(lines=20, lable="Unreal Blueprint generator (Python for Editor)")
29
  ],
30
  title=title,
31
  description=description,
@@ -33,4 +29,4 @@ gradioInterface = gr.Interface(
33
  )
34
 
35
  if __name__ == "__main__":
36
- gradioInterface.launch(share=True)
 
2
  import gradio as gr
3
  from translator.agent import TranslationAgent
4
 
5
+ # Initialize agent (will load mapping table etc.)
6
  agent = TranslationAgent()
7
 
 
8
  def do_translate(csharp_code, target_format, model_choice):
9
+ # target_format: "cpp", "blueprint", "both"
10
  return agent.translate(csharp_code, target_format=target_format, model_choice=model_choice)
11
 
12
+ title = "Unity Unreal Code Translator"
13
  description = "Paste a Unity C# script and get suggested Unreal C++ (.h/.cpp) and an Unreal Python Blueprint-generator script."
14
 
15
+ iface = gr.Interface(
 
16
  fn=do_translate,
 
17
  inputs=[
18
+ gr.Textbox(lines=20, label="Unity C# code"),
19
+ gr.Radio(["cpp", "blueprint", "both"], value="both", label="Target"),
20
+ gr.Radio(["hf_inference", "openai"], value="hf_inference", label="Model backend")
21
  ],
 
22
  outputs=[
23
+ gr.Textbox(lines=20, label="Unreal C++ (.h/.cpp)"),
24
+ gr.Textbox(lines=20, label="Unreal Blueprint generator (Python for Editor)")
25
  ],
26
  title=title,
27
  description=description,
 
29
  )
30
 
31
  if __name__ == "__main__":
32
+ iface.launch()