AirrStorm commited on
Commit
4066c7d
·
1 Parent(s): 0dfb09a

Add examples to make it easier for users

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -6,12 +6,20 @@ def translator(sentence):
6
  translator = pipeline("translation", model=model_checkpoint)
7
  return translator(sentence)[0]['translation_text']
8
 
 
 
 
 
 
 
 
 
9
  # Create a cleaner UI with input and output labels and additional styling
10
  demo = gr.Interface(
11
  fn=translator,
12
  inputs=gr.Textbox(
13
  lines=3,
14
- placeholder="Enter text in English...",
15
  label="Input (English)"
16
  ),
17
  outputs=gr.Textbox(
@@ -22,7 +30,8 @@ demo = gr.Interface(
22
  title="English to French Translator",
23
  description="This tool translates text from English to French. Especially fine-tuned for programming-related terms.",
24
  live=False, # Live updates are not necessary for translation
25
- theme="dark-peach" # Optional: use the Hugging Face theme
 
26
  )
27
 
28
  demo.launch()
 
6
  translator = pipeline("translation", model=model_checkpoint)
7
  return translator(sentence)[0]['translation_text']
8
 
9
+
10
+ examples = [
11
+ ["The program runs without errors"],
12
+ ["I need to debug the code to find the issue."],
13
+ ["The code has a error in line 15."],
14
+ ["I will meet you at the park in the afternoon."],
15
+ ["The weather is beautiful today."]
16
+ ]
17
  # Create a cleaner UI with input and output labels and additional styling
18
  demo = gr.Interface(
19
  fn=translator,
20
  inputs=gr.Textbox(
21
  lines=3,
22
+ placeholder="Enter text in English to translate it into French (e.g., 'The program runs smoothly.')",
23
  label="Input (English)"
24
  ),
25
  outputs=gr.Textbox(
 
30
  title="English to French Translator",
31
  description="This tool translates text from English to French. Especially fine-tuned for programming-related terms.",
32
  live=False, # Live updates are not necessary for translation
33
+ theme="dark-peach", # Optional: use the Hugging Face theme
34
+ examples=examples # Optional: Add examples to make it easier for users
35
  )
36
 
37
  demo.launch()