joshuaberkowitzus commited on
Commit
d3fd5d8
·
verified ·
1 Parent(s): c6b98cf
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -36,7 +36,7 @@ def translate_text(english_text):
36
  # The pipeline returns a list of dictionaries, e.g., [{'translation_text': '...'}]
37
  result = translation_pipeline(english_text)
38
  # Extract the translated text
39
- french_text = result['translation_text']
40
  return french_text
41
  except Exception as e:
42
  print(f"Error during translation: {e}")
@@ -65,9 +65,7 @@ with gr.Blocks() as demo:
65
 
66
  # 4. Add Examples
67
  gr.Examples(
68
- examples=["Hello, how are you?"],
69
- ["Machine learning is fascinating."],
70
- ,
71
  inputs=input_english,
72
  outputs=output_french,
73
  fn=translate_text,
 
36
  # The pipeline returns a list of dictionaries, e.g., [{'translation_text': '...'}]
37
  result = translation_pipeline(english_text)
38
  # Extract the translated text
39
+ french_text = result[0]['translation_text']
40
  return french_text
41
  except Exception as e:
42
  print(f"Error during translation: {e}")
 
65
 
66
  # 4. Add Examples
67
  gr.Examples(
68
+ examples=["Hello, how are you?"],["Machine learning is fascinating."],
 
 
69
  inputs=input_english,
70
  outputs=output_french,
71
  fn=translate_text,